Decompiled source of LCMKP v1.0.0

BepInEx/plugins/KoreanScrapDisplay.dll

Decompiled an hour ago
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.Bootstrap;
using BepInEx.Configuration;
using DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLevelLoader;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Video;

[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyVersion("0.0.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("wesley.korean.scrapdisplay", "LCMKP", "1.0.0")]
public sealed class ScrapDisplayPlugin : BaseUnityPlugin
{
	private sealed class TerminalLoreEntry
	{
		internal readonly string Title;

		internal readonly string Text;

		internal TerminalLoreEntry(string title, string text)
		{
			Title = title;
			Text = text;
		}
	}

	private sealed class TextureRegistration
	{
		internal string Path;

		internal string Texture;

		internal int Width;

		internal int Height;

		internal bool ToyStore;
	}

	private sealed class EventSpeech
	{
		internal AudioSource Source;

		internal AudioClip Clip;

		internal float Start;

		internal float Pitch;
	}

	private sealed class RenderFontSizeState
	{
		internal float[] Sizes;
	}

	private static class PoltergeistHudTranslations
	{
		internal static readonly TranslationScope Scope = new TranslationScope(ReadTerminalTable("PoltergeistText.tsv"), VanillaGameplayLabels);
	}

	private static class LethalHudTranslations
	{
		internal static readonly TranslationScope Scope = new TranslationScope(ReadTerminalTable("LethalHudText.tsv"), VanillaGameplayLabels);
	}

	private static class GeneralImprovementsHudTranslations
	{
		internal static readonly TranslationScope Scope = new TranslationScope(ReadTerminalTable("GeneralImprovementsText.tsv"), VanillaGameplayLabels);
	}

	private static class AdvancedFeaturesHudTranslations
	{
		internal static readonly TranslationScope Scope = new TranslationScope(ReadTerminalTable("AdvancedFeaturesText.tsv"), VanillaGameplayLabels);
	}

	private const string PlacementOffMoonText = "위성에 착륙하지 않았습니다!";

	private const float GeneralTextScale = 0.8f;

	private static readonly Dictionary<string, string> HudNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

	private static Regex hudPattern;

	private static PlayerControllerB imperiumHiddenCursorOwner;

	private static readonly Dictionary<string, string> MoonDescriptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

	private static readonly Dictionary<string, string> MoonInfoDescriptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

	private static readonly Regex MoonNumber = new Regex("^\\s*[-–]?\\d+(?:[-–]\\d+)*(?:\\s*[-–]\\s*|\\s+)");

	private static ScrapDisplayPlugin instance;

	private 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", "벨트 가방" },
		{ "Polaroid", "즉석 카메라" },
		{ "Handlamp", "휴대용 램프" },
		{ "Defibrillator", "제세동기" },
		{ "Blowtorch", "토치 램프" },
		{ "Geiger counter", "가이거 계수기" },
		{ "Bandages", "붕대" },
		{ "Medical Kit", "구급상자" },
		{ "Productivity Autoinjector", "생산성 자동주사기" },
		{ "Shift Controller", "이동 제어기" },
		{ "Padlock", "자물쇠" },
		{ "Crowbar", "쇠지렛대" },
		{ "Left curtain", "왼쪽 커튼" },
		{ "Right curtain", "오른쪽 커튼" },
		{ "Left corner curtain", "왼쪽 모서리 커튼" },
		{ "Right corner curtain", "오른쪽 모서리 커튼" },
		{ "Magic sphere", "마법 구체" },
		{ "Cruiser", "크루저" },
		{ "Battle table", "전투 테이블" },
		{ "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", "보라색 작업복" }
	};

	private static readonly HashSet<string> MissingNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);

	private static readonly Dictionary<string, string> Names = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

	private static readonly Regex ProductCommand = new Regex("^\\s*(?:(?<verb>buy|info|route|view)\\s+)?(?<name>.+?)(?:\\s+(?<amount>[0-9]+))?\\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);

	private static readonly Regex ProductKey = new Regex("[^\\p{L}\\p{N}]");

	private static readonly Dictionary<string, string> StoreHeadings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
	{
		{ "COMPANY STORE", "회사 상점" },
		{ "[ITEMS]", "[장비]" },
		{ "[VEHICLES]", "[차량]" },
		{ "[UNLOCKABLES]", "[함선 설비]" },
		{ "[DECORATIONS]", "[장식품]" },
		{ "[SUITS]", "[의상]" },
		{ "SUITS", "의상" }
	};

	private 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", "정문" },
		{ "Data chip", "데이터 칩" },
		{ "Floppy disc machine", "플로피 디스크 기록기" },
		{ "Key", "열쇠" },
		{ "Apparatice", "장치" },
		{ "Acid storage", "산성액 저장소" },
		{ "Acid pump", "산성액 펌프" },
		{ "Videotape player", "비디오 재생기" },
		{ "Crystal cube", "결정 큐브" },
		{ "Fountain", "분수대" },
		{ "Ritual table", "의식 제단" },
		{ "Well of blood", "피의 우물" },
		{ "Cavil's keycard", "캐빌의 키카드" },
		{ "Log translator", "기록물 판독기" },
		{ "Broken bridge", "부서진 다리" }
	};

	private static readonly Regex StoreLine = new Regex("(?m)^(?<prefix>[ \\t]*(?:\\* )?(?:<[^>\\r\\n]+>[ \\t]*)*)(?<name>[^<\\r\\n]+?)(?=[ \\t]*(?:<[^>\\r\\n]+>[ \\t]*)*(?:\\(?-?\\d+%|\\$\\d|\\r?$))");

	private static readonly Regex VanillaStoreRow = new Regex("(?m)^(?<prefix>[ \\t]*(?:\\* )?)(?<name>[^\\r\\n]+?)[ \\t]+//[ \\t]+Price:[ \\t]*(?<price>\\$[\\d,.]+)(?<discount>[ \\t]*\\(\\d+% OFF!\\))?[ \\t]*(?=\\r?$)");

	private static readonly Regex VanillaStoreDiscount = new Regex("(\\(\\d+)% OFF!\\)");

	private static readonly Dictionary<string, string> RecipeNames = new Dictionary<string, string>(StringComparer.Ordinal)
	{
		{ "Operating panel 1x", "조작 패널 1x" },
		{ "Triangulation device 2x", "삼각측량 장치 2x" },
		{ "Double-barrel shotgun 1x", "쌍열 산탄총 1x" },
		{ "Shotgun shell 4x", "산탄총 탄약 4x" },
		{ "Adrenaline stim 2x", "아드레날린 주사 2x" },
		{ "Health stim 2x", "회복 주사 2x" },
		{ "Pulatrum spore emitter 2x", "풀라트럼 포자 방출기 2x" },
		{ "Boombox 1x", "붐박스 1x" },
		{ "Advanced flashlights 2x", "강화형 손전등 2x" },
		{ "Fog reducer 1x", "안개 제거기 1x" },
		{ "Radar booster 1x", "레이더 부스터 1x" },
		{ "Action figure 1x", "액션 피규어 1x" },
		{ "Weed killer 1x", "제초제 1x" },
		{ "De-weed 1x", "고속 제초제 1x" },
		{ "Pesticide sprinkler 1x", "살충제 분사기 1x" },
		{ "Fabricated key 12x", "제작 열쇠 12x" },
		{ "Blank floppy disc 1x", "빈 플로피 디스크 1x" },
		{ "Single-barrel shotgun 1x", "단열 산탄총 1x" }
	};

	private static readonly Dictionary<string, string> CraftingText = new Dictionary<string, string>
	{
		{ "Plastic stock", "플라스틱 소재" },
		{ "Steel", "강철" },
		{ "Circuit boards", "회로 기판" },
		{ "Copper wiring", "구리 배선" },
		{ "Lithium", "리튬" },
		{ "Rubber", "고무" },
		{ "Cables", "케이블" },
		{ "Chemicals", "화학 물질" },
		{ "Processed materials", "가공 재료" },
		{ "> Fabricate item y/n?", "> 이 물품을 제작할까요? (Y/N)" },
		{ "Not enough resources", "재료 부족" }
	};

	private static readonly Dictionary<string, string> RouteDiscoveryText = new Dictionary<string, string>
	{
		{ "Route Discovered!", "항로 발견!" },
		{ "Location: ", "목적지: " }
	};

	private static readonly Dictionary<string, string> StoreProductKeys = CreateStoreProductKeys();

	private static readonly Dictionary<string, string> CustomSuitNames = new Dictionary<string, string>(ReadTerminalTable("SuitNames.tsv"), StringComparer.OrdinalIgnoreCase);

	private 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:", "할당량 갱신 때마다 판매 장식품이 바뀝니다. 다음 주에 다시 확인하세요." }
	};

	private 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]을 길게 눌러 조기 이륙에 투표하세요." }
	};

	private 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", "지뢰밭" }
	};

	private static readonly Regex MonitorMoonHeading = new Regex("\\A(?<heading>[ \\t]*(?:Orbiting|Landed on|궤도 비행 중|착륙 중):[ \\t]*(?:\\r?\\n[ \\t]*)?)(?<name>[^\\r\\n]+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);

	private static readonly Dictionary<string, string> LandingRiskNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
	{
		{ "Safe", "안전" },
		{ "I see you", "네가 보인다" },
		{ "QUACK", "꽥" },
		{ "B.. for Bees", "B… 벌의 B" }
	};

	private static readonly Dictionary<string, string> DistressSignalText = new Dictionary<string, string>(StringComparer.Ordinal)
	{
		{ "!!!WARNING!!!", "!!!경고!!!" },
		{ "Ship receiving data...", "함선 데이터 수신 중..." },
		{ "Distress signal received:", "조난 신호 수신:" },
		{ "This is an automated message", "자동 발신 메시지입니다." },
		{ "Autopilot ship in critical condition", "자동항법 함선 상태 위급" },
		{ "Crew status:", "승무원 상태:" },
		{ "Autopilot status:", "자동항법 상태:" },
		{ "Navigation status:", "항법 상태:" },
		{ "Unresponsive", "응답 없음" },
		{ "This ship requires immediate assistance", "이 함선은 즉각적인 지원이 필요합니다." },
		{ "AUTOPILOT SHIP ON COLLISION COURSE", "경고: 자동항법 함선 충돌 경로 진입" },
		{ "ESTIMATED TIME BEFORE IMPACT:", "충돌까지 남은 예상 시간:" },
		{ "29 DAYS", "29일" },
		{ "29 HELP", "29 살려 줘" },
		{ "Save us", "우릴 구해 줘" },
		{ "He's crazy", "그 사람 미쳤어" },
		{ "Don't trust him\n", "그 사람을 믿지 마\n" },
		{ "Irreversible damage approaches", "돌이킬 수 없는 피해가 임박했습니다." },
		{ "ABANDON ALL HOPE", "모든 희망을 버려라" },
		{ "Please", "제발" },
		{ "All hope is lost", "이제 희망은 없어" },
		{ "You abandoned us", "너희가 우릴 버렸어" },
		{ "No one is coming", "아무도 오지 않아" },
		{ "No one can hear us", "아무도 우리 목소리를 듣지 못해" },
		{ "Why", "왜" },
		{ "This is the end", "이제 끝이야" },
		{ "Hide\n", "숨어\n" },
		{ "- DAYS", "- 일" },
		{ "GOD IS DEAD", "신은 죽었다" },
		{ "Goodbye", "안녕" },
		{ "Always someone watching from above", "위에선 언제나 누군가 보고 있어" },
		{ "Once we're dust", "우리가 먼지가 되고 나면" },
		{ "The end is near", "끝이 다가온다" },
		{ "Est mat d im act l cat on: \n132-Trite", "충  예  지  :\n132-Trite" },
		{ "C llision imp ct in # ho rs", "충  까지 #시  남음" },
		{ "Pr pare for des ruction", "파  에 대비하라" },
		{ "A andon h pe", "희  을 버려라" },
		{ "Th re is no retu n", "돌아갈 수  어" },
		{ "god ab ndoned us", "신이 우릴 버  다" },
		{ "You have forsaken us\n", "너희가 우릴 저버렸어\n" },
		{ "Goodbye\n", "안녕\n" }
	};

	private static readonly Dictionary<string, string> OldredScreenText = new Dictionary<string, string>(StringComparer.Ordinal)
	{
		{ "      BG IG, A System-Act Ally", "      BG IG, System-Act의 동반자" },
		{ "      Copyright (C) 2084-2108, Halden Electronics Inc.", "      저작권 (C) 2084-2108, Halden Electronics Inc." },
		{ "CPU Type      :     BORSON 300 CPU at 2500 MHz", "CPU 유형      :     BORSON 300 CPU / 2500 MHz" },
		{ "Memory test  :      4521586K OK", "메모리 검사  :      4521586K 정상" },
		{ "Boot Distributioner Application v0.04", "부팅 프로그램 Distributioner v0.04" },
		{ "Copyright (C) 2107 Distributioner", "저작권 (C) 2107 Distributioner" },
		{ "    Detecting Sting X ROM", "    Sting X ROM 감지 중" },
		{ "    Detecting Web LNV Extender", "    Web LNV Extender 감지 중" },
		{ "    Detecting Heartbeats OK", "    심박 감지 정상" },
		{ "UTGF Device Listening...", "UTGF 장치 신호 대기 중..." },
		{ "Body   ID   Neural   Device Class", "본체   ID   신경 ID   장치 등급" },
		{ "Detecting difficulties...", "문제 감지 중..." },
		{ "Running reboot diagnostic...", "재시작 진단 중..." },
		{ "UNABLE TO START.", "시작할 수 없습니다." },
		{ "PLEASE FIX ISSUES", "문제를 해결하십시오." },
		{ "I BELIEVE IN YOU", "난 널 믿어" },
		{ "I promise that ", "약속할게. " },
		{ "I'm going.", "갈 거야." },
		{ "I'm not staying there", "거기 남지 않을 거야" },
		{ "I promise that.", "약속할게." },
		{ "I", "난" }
	};

	private static readonly Dictionary<string, string> BerunahCutsceneText = new Dictionary<string, string>(StringComparer.Ordinal)
	{
		{ "I was there", "나는 거기에 있었다" },
		{ "Whispering in the shadows", "그림자 속에서 속삭이며" },
		{ "It only took one weak mind", "나약한 정신 하나면 충분했다" },
		{ "I sought to become all", "나는 모든 것이 되고자 했다" },
		{ "To feel the universe", "우주를 느끼고" },
		{ "To bend it to my will", "내 뜻대로 굴복시키고" },
		{ "To tear the weak apart", "약한 자들을 찢어발기고" },
		{ "To rid it of inferior beings", "열등한 존재들을 우주에서 지워 버리고자 했다" },
		{ "They were no more", "그들은 고작" },
		{ "Than a grain of sand on the beach of time", "시간의 해변에 놓인 모래 한 알에 불과했다" },
		{ "I am complete", "나는 완전해졌다" },
		{ "The universe was always mine", "우주는 처음부터 내 것이었다" },
		{ "To conquer", "내가 정복할 곳이었다" }
	};

	private static readonly Dictionary<string, string> ReportLabels = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
	{
		{ "Performance Report", "성과 보고서" },
		{ "Notes", "특이 사항" },
		{ "Notes:", "특이 사항:" },
		{ "Deceased", "사망자" },
		{ "Missing", "실종자" },
		{ "Collected:", "회수량:" },
		{ "Grade:", "등급:" },
		{ "Scrap Lost", "잃어버린 스크랩" },
		{ "All Dead", "전원 사망" }
	};

	private static ConfigEntry<bool> translateMoonNames;

	private static ConfigEntry<bool> translateTerminalCommands;

	private static Dictionary<string, string> terminalMoonNames;

	private static Dictionary<string, string> terminalPhrases;

	private static Dictionary<string, string> terminalPages;

	private static Regex moonDisplayPattern;

	private 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", "필터" }
	};

	private 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])");

	private static readonly Regex CommandInQuotes = new Regex("\"(?<command>transmit|switch|ping|flash|view|info|help|confirm|deny)\"", RegexOptions.IgnoreCase);

	private 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);

	private 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);

	private 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", "허리케인" }
	};

	private static readonly Dictionary<string, string> SimulationDungeonNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
	{
		{ "AquaticDungeonFlow", "아틀란티스 성채" },
		{ "CarnivalFlow", "카니발" },
		{ "LabFlow", "드레드랩" },
		{ "ExpandedFacility", "확장 시설" },
		{ "Level3ButCoolFlowRenewed", "확장 폐광" },
		{ "FracturedComplexFlow", "파손된 단지" },
		{ "Grand Armory", "대형 무기고" },
		{ "GrandArmoryFlow", "대형 무기고" },
		{ "GreenhouseFlow", "온실" },
		{ "MuseumInteriorFlow", "미술관" },
		{ "DeepSewersFlow", "깊은 하수도" },
		{ "SpookyManorFlow", "음산한 저택" },
		{ "RubberRoomsFlow", "고무벽 격리실" },
		{ "Toy Store", "장난감 가게" }
	};

	private static readonly Regex SimulationDestination = new Regex("(?m)^Simulating arrival to (?<planet>[^\\r\\n]+)");

	private static readonly Regex SimulationStructure = new Regex("(?m)^\\* (?<name>[^\\r\\n]+?)(?=[ \\t]+//)");

	private static readonly Dictionary<string, string> WesleyTerminalLines = ReadTerminalTable("WesleyTerminalLines.tsv");

	private static readonly Regex TerminalLine = new Regex("(?m)^(?<leading>[ \\t]*)(?<text>\\S[^\\r\\n]*?)(?<trailing>[ \\t]*)(?=\\r?$)");

	[ThreadStatic]
	private static int lguTerminalRenderDepth;

	private static readonly Regex LguLayoutTags = new Regex("<[^>\\r\\n]+>");

	private static readonly Regex LguMenuColumns = new Regex("^(?<name>.+?)\\s+(?<levels>(?:<[^>]+>)*[○●◯◉◎◌★☆■□]+(?:</[^>]+>)*)\\s+(?<price>(?:<[^>]+>)*(?:\\$[\\d,]+|[\\d,]+\\$|최대\\s*레벨!|MAX(?:IMUM)?\\s*LEVEL).*?)$");

	private static readonly Regex LguHelpHeading = new Regex("^(?<indent>[ \\t]*)>[ \\t]*LATEGAME(?:[ \\t]+UPGRADES)?[ \\t]*(?=\\r?$)", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant);

	private static readonly Dictionary<string, string> LethalSnapControlText = new Dictionary<string, string>(ReadTerminalTable("LethalSnapControlText.tsv"), StringComparer.OrdinalIgnoreCase);

	private static FieldInfo brutalHudKeyLetter;

	private static readonly Dictionary<string, TerminalLoreEntry> LoreByAsset = new Dictionary<string, TerminalLoreEntry>(StringComparer.OrdinalIgnoreCase);

	private static readonly Dictionary<string, TerminalLoreEntry> LoreByEnglishTitle = new Dictionary<string, TerminalLoreEntry>(StringComparer.OrdinalIgnoreCase);

	private static readonly ConditionalWeakTable<TerminalNode, TerminalLoreEntry> RegisteredLore = new ConditionalWeakTable<TerminalNode, TerminalLoreEntry>();

	private 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);

	private static readonly Dictionary<string, string> WesleyStoryLogTitles = ReadTerminalTable("WesleyStoryLogTitles.tsv");

	private static readonly Dictionary<string, string> WesleyInteractionNames = new Dictionary<string, string>(ReadTerminalTable("WesleyInteractionText.tsv"), StringComparer.OrdinalIgnoreCase);

	private static readonly Regex InteractionKeySuffix = new Regex("(?<suffix>[ \\t]*:?[ \\t]*\\[(?!\\d+[ \\t]*/)[^\\]\\r\\n]+\\][ \\t]*)\\z");

	private static readonly Regex InteractionProgressSuffix = new Regex("(?<suffix>[ \\t]+(?:\\(\\d+/\\d+\\)|\\[\\d+/\\d+\\]))\\z");

	private static readonly Regex NumberedInteraction = new Regex("\\A(?<action>Insert|Floor|Spawn wave)[ \\t]+(?<number>\\d+)\\z", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);

	private static readonly Dictionary<string, string> WesleyScanLabels = new Dictionary<string, string>(ReadTerminalTable("WesleyScanText.tsv"), StringComparer.OrdinalIgnoreCase);

	private static readonly Dictionary<string, string> ScanEntityAliases = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
	{
		{ "SCP-096 Shy Guy", "SCP-096 수줍은 남자" },
		{ "Contaminated Snare flea", "오염된 올가미 벼룩" },
		{ "Cadaver monstrosity", "시체꽃 괴물" },
		{ "Assimilation tendrils", "동화 촉수" },
		{ "Bracken?", "우주 브래켄?" },
		{ "void-head", "공허의 머리" },
		{ "Landmine", "지뢰" },
		{ "Turret", "포탑" },
		{ "Masked", "가면 쓴 자" },
		{ "Ghost girl", "유령 소녀" },
		{ "Dog", "눈 없는 개" },
		{ "MouthDog", "눈 없는 개" },
		{ "Forest giant", "숲지기" },
		{ "Crawler", "썸퍼" },
		{ "Blob", "하이그로디어" },
		{ "Puffer", "포자 도마뱀" },
		{ "Flower man", "브래켄" },
		{ "Red bees", "회로 벌" },
		{ "Baboon duck", "개코원숭이 오리" },
		{ "BlackwhiteConfetbees", "흑백 색종이 벌" },
		{ "Black and white confetbees", "흑백 색종이 벌" },
		{ "Butler Bees", "집사 벌" },
		{ "Disturbed masked", "불안의 가면을 쓴 자" },
		{ "Dirty disturbed masked", "때 묻은 불안의 가면을 쓴 자" },
		{ "Gold disturbed masked", "황금 불안의 가면을 쓴 자" },
		{ "Docile Locust Bees", "온순한 메뚜기벌" },
		{ "Red Locust Bees", "붉은 메뚜기벌" },
		{ "Emma", "엠마" },
		{ "ForestGiant", "숲지기" },
		{ "GiantKiwi", "거대 키위새" },
		{ "Key wielding Nutcracker", "열쇠를 든 호두까기 인형" },
		{ "RunningLasso", "달리는 올가미" },
		{ "Skinned Crawler", "가죽이 벗겨진 썸퍼" }
	};

	private static readonly Dictionary<string, string> WesleySceneLabels = ReadTerminalTable("WesleySceneText.tsv");

	private static readonly Dictionary<string, string> PlacementLabels = new Dictionary<string, string>
	{
		{ "CustomStoryLogs Placement Tool\nAlt+L: Toggle Menu\t\tAlt+K: Toggle Edit", "스토리 로그 배치 도구\nAlt+L: 메뉴 열기/닫기\t\tAlt+K: 편집 모드 전환" },
		{ "Moon", "위성" },
		{ "Position", "위치" },
		{ "Rotation", "회전" },
		{ "Save to Json", "JSON으로 저장" },
		{ "Enter text...", "입력…" }
	};

	private static readonly Dictionary<string, TextureRegistration> WesleyTextureMaterials = ReadTextureRegistry();

	private static readonly Dictionary<string, Texture2D> TranslatedTextures = new Dictionary<string, Texture2D>(StringComparer.Ordinal);

	private static readonly Dictionary<string, string> VanillaMenuLabels = new Dictionary<string, string>(ReadTerminalTable("VanillaMenuText.tsv"), StringComparer.OrdinalIgnoreCase);

	private static readonly Regex MenuDecoratedLabel = new Regex("\\A(?<lead>>[ \\t]*|\\[[ \\t]*)(?<label>[^]\\r\\n]+?)(?<tail>[ \\t]*\\]?)\\z");

	private static readonly Regex MenuVersionMismatch = new Regex("\\AThe server host is playing on version (.+?) while you are on version (.+?)\\.\\z");

	private static readonly Regex MenuPlayerCount = new Regex("\\APlayers:[ \\t]*(\\d+[ \\t]*/[ \\t]*\\d+)\\z");

	private static readonly Regex MenuCollectedScore = new Regex("\\A(\\$[\\d,.]+) Collected\\z");

	private static readonly Regex MenuDeleteFile = new Regex("\\ADo you want to delete File (\\d+)\\?\\z");

	private static readonly HashSet<string> VanillaSettingsDropdowns = new HashSet<string>(StringComparer.Ordinal) { "FullscreenMode", "FramerateCap", "TerrainDetail", "MotionBlur", "PixelRes" };

	private static readonly Dictionary<string, string> VanillaGameplayLabels = new Dictionary<string, string>(ReadTerminalTable("VanillaGameplayText.tsv"), StringComparer.OrdinalIgnoreCase);

	private 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", "할퀴임" }
	};

	private static readonly Dictionary<string, string> GameplayRankNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
	{
		{ "Intern", "인턴" },
		{ "Part-timer", "시간제 직원" },
		{ "Employee", "직원" },
		{ "Leader", "팀장" },
		{ "Boss", "관리자" }
	};

	private static readonly Regex NewJournalNotice = new Regex("\\AFound journal entry: '(.+)'\\z");

	private static readonly Regex GameplayReportLine = new Regex("(?m)^(?<lead>[ \\t]*(?:\\*[ \\t]+)?)(?<body>[^\\r\\n]+)");

	private static readonly Regex FeverStatus = new Regex("\\AHIGH FEVER DETECTED!\\nREACHING (.+?)°F\\z");

	private static readonly Regex FilterStatus = new Regex("\\AHEALTH RISK!\\nAir filter overwhelmed by particulates;\\n\\nFilter quality: (\\d+)%\\z");

	private static readonly Regex WesleyFilterBlockage = new Regex("\\AHEALTH RISK!\\n\\nForeign matter in the air filter\\n\\nFilter blockage: (\\d+)%\\z");

	private static readonly Regex WesleyItemUses = new Regex("\\A(\\d+) uses left\\z");

	private static readonly Regex DisplayedSeed = new Regex("\\ARandom seed: (-?\\d+)\\z");

	private static readonly Regex FormatterStoreCell = new Regex("^(?<prefix>(?:\\* )?(?:<[^>]+>[ \\t]*)*)(?<name>.*?)(?<discount>[ \\t]+(?:<[^>]+>[ \\t]*)*\\(?-\\d+%.*)?$");

	private static readonly Regex FormatterTags = new Regex("<[^>\\r\\n]+>");

	private static readonly Regex FormatterDivider = new Regex("^[-─═]+$");

	private static bool baconTerminalInstalled;

	private static Func<bool> baconModernPages;

	private static Dictionary<string, string> baconTerminalText;

	private static Regex baconTerminalPhrases;

	private static readonly Regex BaconTextRuns = new Regex("<[^>]*>|[^<]+|<");

	private static readonly Dictionary<string, string> BaconSettingValues = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
	{
		{ "Original", "기본" },
		{ "Amber", "호박색" },
		{ "Ice", "얼음색" },
		{ "Company", "회사" },
		{ "Vapor", "분홍/보라" },
		{ "Mono", "흑백" },
		{ "Modern", "현대식" },
		{ "Compact", "작게" },
		{ "Retro", "복고풍" },
		{ "Classic", "기존 방식" },
		{ "Normal", "보통" },
		{ "High", "높음" },
		{ "Max", "최대" }
	};

	private static Type shipMedStationType;

	private static Type shipWindowShutterType;

	private readonly Dictionary<string, WesleySubtitleTrack> videoSubtitles = new Dictionary<string, WesleySubtitleTrack>(StringComparer.Ordinal);

	private readonly List<VideoPlayer> subtitlePlayers = new List<VideoPlayer>();

	private FieldInfo cassetteScreenPlayer;

	private GameObject subtitleCanvas;

	private GameObject subtitlePanel;

	private TextMeshProUGUI subtitleLabel;

	private string videoSubtitleStatus;

	private bool videoSubtitleHudTickStarted;

	private readonly Dictionary<string, WesleySubtitleTrack> routeAudioSubtitles = new Dictionary<string, WesleySubtitleTrack>(StringComparer.Ordinal);

	private readonly List<AudioSource> routeSubtitleSources = new List<AudioSource>();

	private float nextRouteSourceScan;

	private string selectedRouteSubtitleClip = "";

	private static MethodInfo subtitleCutsceneInstance;

	private static MethodInfo subtitleCutsceneCamera;

	private static MethodInfo subtitleCutscenePlaying;

	private readonly List<EventSpeech> eventSpeech = new List<EventSpeech>();

	private 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")
	};

	private static readonly HashSet<TMP_Text> ReducedFontRenders = new HashSet<TMP_Text>();

	private static FieldInfo fancyWeatherMonitorTexts;

	private static FieldInfo terminalStoreEntryItem;

	private static FieldInfo terminalShopRegistrations;

	private static FieldInfo terminalShopItem;

	private static FieldInfo terminalShopWasRemoved;

	private static readonly Dictionary<string, string> TerminalUtilsOptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
	{
		{ "name", "이름" },
		{ "namenumbered", "번호와 이름" },
		{ "price", "가격" },
		{ "weather", "날씨" },
		{ "difficulty", "난이도" },
		{ "constellation", "별자리" },
		{ "none", "없음" },
		{ "lunar", "루나" }
	};

	private static string TranslateHud(string value)
	{
		if (string.IsNullOrEmpty(value))
		{
			return value;
		}
		return hudPattern.Replace(value, (Match match) => HudNames[match.Value]);
	}

	private static void TranslateCursor(PlayerControllerB __instance)
	{
		if ((Object)(object)__instance.cursorTip != (Object)null)
		{
			string text = ((TMP_Text)__instance.cursorTip).text;
			text = TranslateShipInteractionCursor(__instance.hoveringOverTrigger, text);
			if (text != null && IsCraftingMoon())
			{
				text = TranslateCraftingCursor(text);
			}
			((TMP_Text)__instance.cursorTip).text = TranslateHud(TranslateWesleyInteraction(TranslateSuitCursor(text)));
		}
	}

	private static string TranslateCraftingCursor(string tip)
	{
		if (tip == "Not enough resources")
		{
			return CraftingText[tip];
		}
		return Regex.Replace(tip, "^(Next|Previous|Confirm)(?=\\s*:)", (Match match) => match.Value switch
		{
			"Next" => "다음", 
			"Previous" => "이전", 
			_ => "제작 확인", 
		});
	}

	private 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(TranslateWesleyInteraction(TranslateVanillaGameplayText(((TMP_Text)val).text)));
			}
		}
	}

	private 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 Awake()
	{
		//IL_0913: Unknown result type (might be due to invalid IL or missing references)
		//IL_0920: Expected O, but got Unknown
		//IL_098e: Unknown result type (might be due to invalid IL or missing references)
		//IL_099b: Expected O, but got Unknown
		//IL_0aa4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aab: Expected O, but got Unknown
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Expected O, but got Unknown
		//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_030b: Expected O, but got Unknown
		//IL_0335: Unknown result type (might be due to invalid IL or missing references)
		//IL_033c: Expected O, but got Unknown
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_037f: Expected O, but got Unknown
		//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d5: Expected O, but got Unknown
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Expected O, but got Unknown
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Expected O, but got Unknown
		//IL_0496: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Expected O, but got Unknown
		//IL_0525: Unknown result type (might be due to invalid IL or missing references)
		//IL_052c: Expected O, but got Unknown
		//IL_0568: Unknown result type (might be due to invalid IL or missing references)
		//IL_056f: Expected O, but got Unknown
		//IL_0688: Unknown result type (might be due to invalid IL or missing references)
		//IL_068f: Expected O, but got Unknown
		//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d8: Expected O, but got Unknown
		//IL_0702: Unknown result type (might be due to invalid IL or missing references)
		//IL_070f: Expected O, but got Unknown
		//IL_0760: Unknown result type (might be due to invalid IL or missing references)
		//IL_076d: Expected O, but got Unknown
		//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0805: Expected O, but got Unknown
		//IL_0650: Unknown result type (might be due to invalid IL or missing references)
		//IL_065e: Expected O, but got Unknown
		instance = this;
		using (Stream stream = ((object)this).GetType().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 = ((object)this).GetType().Assembly.GetManifestResourceStream("HudText.tsv"))
		{
			using StreamReader streamReader2 = new StreamReader(stream2);
			string text2;
			while ((text2 = streamReader2.ReadLine()) != null)
			{
				string[] array2 = text2.Split('\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 = ((object)this).GetType().Assembly.GetManifestResourceStream("ScrapNames.tsv"))
		{
			using StreamReader streamReader3 = new StreamReader(stream3);
			string text3;
			while ((text3 = streamReader3.ReadLine()) != null)
			{
				string[] array3 = text3.Split('\t');
				Names.Add(array3[0], array3[1]);
			}
		}
		Harmony val = new Harmony("wesley.korean.scrapdisplay");
		Type type = AccessTools.TypeByName("Imperium.Core.Lifecycle.PlayerManager");
		if (type != null)
		{
			MethodInfo methodInfo = AccessTools.Method(type, "ToggleHUD", new Type[1] { typeof(bool) }, (Type[])null);
			if (methodInfo != null)
			{
				val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "TrackImperiumCursor", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				val.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), "HideHUD", new Type[1] { typeof(bool) }, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "RestoreImperiumCursor", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}
		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 methodInfo2 = AccessTools.Method(typeof(HUDManager), "ShowPlayersFiredScreen", (Type[])null, (Type[])null);
		HarmonyMethod val2 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateFiredScreen", (Type[])null);
		val2.priority = 0;
		val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		MethodInfo methodInfo3 = AccessTools.Method(typeof(StartOfRound), "SetMapScreenInfoToCurrentLevel", (Type[])null, (Type[])null);
		HarmonyMethod val3 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateMapScreen", (Type[])null);
		val3.priority = 0;
		val.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		MethodInfo methodInfo4 = AccessTools.EnumeratorMoveNext((MethodBase)AccessTools.Method(typeof(StartOfRound), "openingDoorsSequence", (Type[])null, (Type[])null));
		if (methodInfo4 != null)
		{
			HarmonyMethod val4 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateLandingInfo", (Type[])null);
			val4.priority = 0;
			val.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, val4, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
		string[] array4 = new string[7] { "Update", "SetShipLeaveEarlyVotesText", "DisplayNewDeadline", "DisplayDaysLeft", "DisplaySpectatorVoteTip", "SetSpectatingTextToPlayer", "UpdateWeightCounter" };
		foreach (string text4 in array4)
		{
			Patch(val, AccessTools.Method(typeof(HUDManager), text4, (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[] array5 = new string[2] { "SetShipLeaveEarlyClientRpc", "ShipFullCapacityMidnightClientRpc" };
		foreach (string text5 in array5)
		{
			Patch(val, AccessTools.Method(typeof(TimeOfDay), text5, (Type[])null, (Type[])null), "StatusTextTranspiler");
		}
		MethodInfo methodInfo5 = AccessTools.Method(typeof(TimeOfDay), "UpdateProfitQuotaCurrentTime", (Type[])null, (Type[])null);
		HarmonyMethod val5 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateQuotaMonitors", (Type[])null);
		val5.priority = 0;
		val.Patch((MethodBase)methodInfo5, (HarmonyMethod)null, val5, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		MethodInfo methodInfo6 = AccessTools.Method(typeof(HUDManager), "SetClock", (Type[])null, (Type[])null);
		HarmonyMethod val6 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateClock", (Type[])null);
		val6.priority = 0;
		val.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, val6, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		Type type2 = AccessTools.TypeByName("GeneralImprovements.Utilities.MonitorsHelper");
		if (type2 != null)
		{
			fancyWeatherMonitorTexts = AccessTools.Field(type2, "_fancyWeatherMonitorTexts");
			foreach (MethodInfo declaredMethod in AccessTools.GetDeclaredMethods(type2))
			{
				if (declaredMethod.Name.StartsWith("Update", StringComparison.Ordinal) && declaredMethod.Name.EndsWith("Monitors", StringComparison.Ordinal))
				{
					Patch(val, declaredMethod, "StatusTextTranspiler");
				}
			}
			Patch(val, AccessTools.Method(type2, "CopyProfitQuotaAndDeadlineTexts", (Type[])null, (Type[])null), "QuotaCopyTranspiler");
			val.Patch((MethodBase)AccessTools.Method(type2, "UpdateGenericTextList", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateMonitorText", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
		MethodInfo methodInfo7 = AccessTools.Method(typeof(ShipBuildModeManager), "CreateGhostObjectAndHighlight", (Type[])null, (Type[])null);
		HarmonyMethod val7 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateBuildControls", (Type[])null);
		val7.priority = 0;
		val.Patch((MethodBase)methodInfo7, (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[] array6 = new string[2] { "ChangeControlTip", "ChangeControlTipMultiple" };
		foreach (string text6 in array6)
		{
			val.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), text6, (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 methodInfo8 = AccessTools.Method(typeof(HUDManager), "DisplayCreditsEarning", (Type[])null, (Type[])null);
		Patch(val, methodInfo8, "ItemTranspiler");
		HarmonyMethod val8 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateSalesReceipt", (Type[])null);
		val8.priority = 0;
		val.Patch((MethodBase)methodInfo8, (HarmonyMethod)null, val8, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		PatchTerminal(val);
		PatchVanillaMenus(val);
		try
		{
			PatchLguTerminalLayout(val);
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("LGU terminal layout could not be installed: " + ex));
		}
		try
		{
			PatchLguTerminalCommands(val);
		}
		catch (Exception ex2)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("LGU terminal commands could not be installed: " + ex2));
		}
		try
		{
			PatchLethalSnapControls(val);
		}
		catch (Exception ex3)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Lethal Snap control translation could not be installed: " + ex3));
		}
		try
		{
			PatchBrutalHudTypography(val);
		}
		catch (Exception ex4)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Brutal HUD typography could not be installed: " + ex4));
		}
		PatchVanillaGameplay(val);
		PatchWesleyStoryLogTitles(val);
		PatchWesleySceneUi(val);
		PatchModHud(val);
		MethodInfo methodInfo9 = AccessTools.Method(typeof(StartOfRound), "Start", (Type[])null, (Type[])null);
		if (methodInfo9 != null)
		{
			val.Patch((MethodBase)methodInfo9, (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "CheckRegisteredScrap", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
		Type type3 = AccessTools.TypeByName("WesleysInteriorTools.Features.FactoryCraftingStation");
		if (type3 != null)
		{
			Patch(val, AccessTools.Method(type3, "UpdateSelectedItemClientRpc", (Type[])null, (Type[])null), "RecipeTranspiler");
			Patch(val, AccessTools.Method(type3, "CheckIfEnoughItems", (Type[])null, (Type[])null), "CraftingPromptTranspiler");
			val.Patch((MethodBase)AccessTools.Method(type3, "OnNetworkSpawn", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateMaterialDisplay", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
		Type type4 = AccessTools.TypeByName("WesleyMoonScripts.Components.LevelCassetteLoader");
		if (type4 != null)
		{
			Patch(val, AccessTools.Method(type4, "TapeEnded", (Type[])null, (Type[])null), "RouteDiscoveryTranspiler");
		}
		Type type5 = AccessTools.TypeByName("WesleysInteriorTools.Features.DayCounterEvent");
		if (type5 != null)
		{
			Patch(val, AccessTools.Method(type5, "PlayWarningClientRpc", new Type[2]
			{
				typeof(int),
				typeof(int)
			}, (Type[])null), "TranslateDistressCountdown");
		}
		SceneManager.sceneLoaded += TranslateWesleySceneText;
		string[] array7 = new string[4] { "Start", "GrabItem", "EquipItem", "LoadItemSaveData" };
		foreach (string text7 in array7)
		{
			MethodInfo methodInfo10 = AccessTools.Method(typeof(GrabbableObject), text7, (Type[])null, (Type[])null);
			if (methodInfo10 != null)
			{
				HarmonyMethod val9 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateSpawnedItemLabels", (Type[])null);
				val9.priority = 0;
				val.Patch((MethodBase)methodInfo10, (HarmonyMethod)null, val9, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}
		InitializeVideoSubtitles(val);
		InitializeFontRendering(val);
	}

	private void OnDestroy()
	{
		SceneManager.sceneLoaded -= TranslateWesleySceneText;
		DestroyVideoSubtitles();
	}

	private static void TrackImperiumCursor(bool __0)
	{
		GameNetworkManager val = GameNetworkManager.Instance;
		imperiumHiddenCursorOwner = ((__0 && (Object)(object)val != (Object)null) ? val.localPlayerController : null);
	}

	private static void RestoreImperiumCursor(bool __0)
	{
		if (__0)
		{
			return;
		}
		PlayerControllerB val = imperiumHiddenCursorOwner;
		imperiumHiddenCursorOwner = null;
		GameNetworkManager val2 = GameNetworkManager.Instance;
		if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null) && !((Object)(object)val != (Object)(object)val2.localPlayerController))
		{
			if ((Object)(object)val.cursorTip != (Object)null)
			{
				((Component)val.cursorTip).gameObject.SetActive(true);
			}
			if ((Object)(object)val.cursorIcon != (Object)null)
			{
				((Component)val.cursorIcon).gameObject.SetActive(true);
			}
		}
	}

	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));
		}
	}

	private 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);
				if ((Object)(object)items.spawnPrefab != (Object)null)
				{
					TranslateCraftingBoards(items.spawnPrefab);
				}
			}
		}
		GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(true);
		foreach (GrabbableObject _instance in array)
		{
			TranslateSpawnedItemLabels(_instance);
		}
	}

	private 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;
	}

	private 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;
	}

	private static string ScanName(ScanNodeProperties node)
	{
		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) || WesleyScanLabels.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);
	}

	private 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));
			}
		}
	}

	private 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;
		}
	}

	private 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)
		{
			dictionary[item.Key] = StoreNames[item.Value];
		}
		return dictionary;
	}

	private 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;
	}

	private 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;
	}

	private 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;
	}

	private 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() + 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;
	}

	private 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();
				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));
			});
		}
	}

	private static bool IsCraftingMoon()
	{
		StartOfRound val = StartOfRound.Instance;
		if ((Object)(object)val == (Object)null || (Object)(object)val.currentLevel == (Object)null)
		{
			return false;
		}
		string moonName = GetMoonName(val.currentLevel.PlanetName);
		if (!string.Equals(moonName, "Gratar", StringComparison.OrdinalIgnoreCase))
		{
			return string.Equals(moonName, "Galetry", StringComparison.OrdinalIgnoreCase);
		}
		return true;
	}

	private static string RecipeName(string english)
	{
		if (!IsCraftingMoon() || !RecipeNames.TryGetValue(english, out var value))
		{
			return english;
		}
		return value;
	}

	private static string TranslateCraftingText(string english)
	{
		if (!IsCraftingMoon() || !CraftingText.TryGetValue(english, out var value))
		{
			return english;
		}
		return value;
	}

	private static void TranslateMaterialDisplay(Component __instance)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		if (!IsCraftingMoon())
		{
			return;
		}
		Scene scene = __instance.gameObject.scene;
		if (!((Scene)(ref scene)).isLoaded)
		{
			return;
		}
		Scene scene2 = __instance.gameObject.scene;
		GameObject[] rootGameObjects = ((Scene)(ref scene2)).GetRootGameObjects();
		foreach (GameObject val in rootGameObjects)
		{
			TranslateCraftingBoards(val);
			TMP_Text[] componentsInChildren = val.GetComponentsInChildren<TMP_Text>(true);
			foreach (TMP_Text val2 in componentsInChildren)
			{
				string text = val2.text;
				if (!string.IsNullOrEmpty(text))
				{
					string value;
					string text2 = Regex.Replace(text, "(?m)^(?<prefix>[ \\t]*(?:>[ \\t]*)?)(?<name>[A-Za-z]+(?: [A-Za-z]+)*)(?=[ \\t]*(?:-\\s*\\d|\\r?$))", (Match match) => (!CraftingText.TryGetValue(match.Groups["name"].Value, out value)) ? match.Value : (match.Groups["prefix"].Value + value));
					if (text2 != text)
					{
						val2.text = text2;
					}
				}
			}
		}
	}

	private static IEnumerable<CodeInstruction> ScanTranspiler(IEnumerable<CodeInstruction> instructions)
	{
		return ReplaceRead(ReplaceRead(instructions, AccessTools.Field(typeof(ScanNodeProperties), "headerText"), "ScanName"), AccessTools.Field(typeof(ScanNodeProperties), "subText"), "ScanDescription");
	}

	private 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;
		}
	}

	private 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;
		});
	}

	private static void TranslateMonitorText(List<TextMeshProUGUI> __0, ref string __1)
	{
		if (PrepareFancyWeatherArt(__0, ref __1))
		{
			return;
		}
		__1 = TranslateWeatherLine(__1);
		if (!string.IsNullOrEmpty(__1) && MonitorMoonHeading.IsMatch(__1))
		{
			StartOfRound val = StartOfRound.Instance;
			if ((Object)(object)val != (Object)null && (Object)(object)val.currentLevel != (Object)null)
			{
				__1 = TranslateMonitorMoonName(__1, val.currentLevel.PlanetName);
			}
		}
	}

	private static string TranslateMonitorMoonName(string text, string planetName)
	{
		return MonitorMoonHeading.Replace(text, (Match match) => match.Groups["heading"].Value + BilingualMoonName(match.Groups["name"].Value, planetName), 1);
	}

	private 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 + ")";
	}

	private static IEnumerable<CodeInstruction> MoonDescriptionTranspiler(IEnumerable<CodeInstruction> instructions)
	{
		return ReplaceRead(instructions, AccessTools.Field(typeof(SelectableLevel), "LevelDescription"), "GetMoonDescription");
	}

	private static string GetMoonDescription(SelectableLevel level)
	{
		if (!MoonDescriptions.TryGetValue(GetMoonName(level.PlanetName), out var value))
		{
			return level.LevelDescription;
		}
		return value;
	}

	private static string GetMoonName(string planetName)
	{
		string text = MoonNumber.Replace(planetName ?? "", "").Trim();
		if (string.Equals(text, "Researcher_6_x1753B", StringComparison.OrdinalIgnoreCase))
		{
			return "ResearcherxB";
		}
		return text;
	}

	private 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));
	}

	private 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);
	}

	private 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.", "소수 종이 우세합니다.");
	}

	private 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);
			Material[] array = Resources.FindObjectsOfTypeAll<Material>();
			foreach (Material material in array)
			{
				TranslateLocalizedMaterial(material, moonName);
			}
			if (string.Equals(moonName, "Narcotic", StringComparison.OrdinalIgnoreCase))
			{
				TranslateNarcoticWarning(((TMP_Text)val.planetInfoHeaderText).font);
			}
			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);
		}
	}

	private static void TranslateNarcoticWarning(TMP_FontAsset hudFont)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		TextMeshProUGUI[] array = Resources.FindObjectsOfTypeAll<TextMeshProUGUI>();
		foreach (TextMeshProUGUI val in array)
		{
			Scene scene = ((Component)val).gameObject.scene;
			if (((Scene)(ref scene)).isLoaded && !(((TMP_Text)val).text != "!!!WARNING!!!"))
			{
				if ((Object)(object)((TMP_Text)val).font == (Object)null || !((TMP_Text)val).font.HasCharacter('경', true, false) || !((TMP_Text)val).font.HasCharacter('고', true, false))
				{
					((TMP_Text)val).font = hudFont;
				}
				((TMP_Text)val).text = "!!!경고!!!";
			}
		}
	}

	private static void TranslateWesleySceneText(Scene scene, LoadSceneMode mode)
	{
		if (((Scene)(ref scene)).name == "SpecialPlaceScene" || ((Scene)(ref scene)).name == "FilitriosScene" || ((Scene)(ref scene)).name == "EndScene" || ((Scene)(ref scene)).name == "RepressScene")
		{
			Material[] array = Resources.FindObjectsOfTypeAll<Material>();
			foreach (Material material in array)
			{
				TranslateWesleyTextureMaterial(material);
			}
		}
		HUDManager val = HUDManager.Instance;
		TMP_FontAsset hudFont = (((Object)(object)val == (Object)null || (Object)(object)val.planetInfoHeaderText == (Object)null) ? null : ((TMP_Text)val.planetInfoHeaderText).font);
		GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
		foreach (GameObject val2 in rootGameObjects)
		{
			bool flag = ((Object)val2).name == "ShipWarningDisplay";
			bool flag2 = ((Scene)(ref scene)).name == "OldredScene" && ((Object)val2).name == "Cube.002";
			bool flag3 = ((Scene)(ref scene)).name == "BerunahScene" && ((Object)val2).name == "Cutscenestuff";
			bool flag4 = ((Scene)(ref scene)).name == "EmpraScene" && ((Object)val2).name == "Cutscenestuff";
			bool flag5 = ((Scene)(ref scene)).name == "SpecialPlaceScene" && ((Object)val2).name == "Environment";
			if (!flag && !flag2 && !flag3 && !flag4 && !flag5)
			{
				continue;
			}
			TMP_Text[] componentsInChildren = val2.GetComponentsInChildren<TMP_Text>(true);
			foreach (TMP_Text val3 in componentsInChildren)
			{
				string text = val3.text ?? "";
				string value = text;
				if (flag)
				{
					if (!DistressSignalText.TryGetValue(text, out value))
					{
						continue;
					}
				}
				else if (flag3)
				{
					if (!BerunahCutsceneText.TryGetValue(text, out value))
					{
						continue;
					}
				}
				else if (flag4 && ((Object)val3).name == "LowO2Warning" && text == "ALERT!")
				{
					value = "경고!";
				}
				else if (flag5 && ((Object)val3).name == "doorHydraulics" && text == "DOOR POWER:")
				{
					value = StatusText[text];
				}
				else if (flag2 && (((Object)val3).name.StartsWith("LogText", StringComparison.Ordinal) || ((Object)val3).name.StartsWith("Quote", StringComparison.Ordinal)))
				{
					string[] array2 = text.Split('\n');
					for (int l = 0; l < array2.Length; l++)
					{
						if (OldredScreenText.TryGetValue(array2[l], out value))
						{
							array2[l] = value;
						}
					}
					value = string.Join("\n", array2);
				}
				if (value != text)
				{
					SetWesleySceneText(val3, value, hudFont);
				}
			}
		}
	}

	private static void SetWesleySceneText(TMP_Text label, string translated, TMP_FontAsset hudFont)
	{
		if ((Object)(object)hudFont != (Object)null)
		{
			foreach (char c in translated)
			{
				if (c >= '가' && c <= '힣' && ((Object)(object)label.font == (Object)null || !label.font.HasCharacter(c, true, false)))
				{
					label.font = hudFont;
					break;
				}
			}
		}
		label.text = translated;
	}

	private static IEnumerable<CodeInstruction> TranslateDistressCountdown(IEnumerable<CodeInstruction> instructions)
	{
		foreach (CodeInstruction instruction in instructions)
		{
			if (instruction.opcode == OpCodes.Ldstr)
			{
				if (object.Equals(instruction.operand, " DAYS"))
				{
					instruction.operand = "일";
				}
				else if (object.Equals(instruction.operand, " HELP"))
				{
					instruction.operand = " 살려 줘";
				}
			}
			yield return instruction;
		}
	}

	private 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) ? ":" : "");
			}
		}
	}

	private 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")) ? "오후" : "오전");
		}
	}

	private 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 = "수익 할당량 달성까지";
			}
		}
	}

	private 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);
	}

	private 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);
			}
		}
	}

	private static IEnumerable<CodeInstruction> QuotaCopyTranspiler(IEnumerable<CodeInstruction> instructions)
	{
		foreach (CodeInstruction instruction in instructions)
		{
			MethodInfo method = instruction.operand as MethodInfo;
			if (method != null && method.Name == "UpdateGenericTextList")
			{
				CodeInstruction translate = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ScrapDisplayPlugin), "TranslateQuotaText", (Type[])null, (Type[])null));
				translate.labels.AddRange(instruction.labels);
				instruction.labels.Clear();
				yield return translate;
			}
			yield return instruction;
		}
	}

	private 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 = "기한 내에 수익 할당량을 달성하지 못했습니다.";
			}
		}
	}

	private 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 = "판매 정산";
			}
		}
	}

	private 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;
			}
		}
	}

	private 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;
			}
		}
	}

	private 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:", "보관:");
		}
	}

	private static string ScanDescription(ScanNodeProperties node)
	{
		switch (node.subText)
		{
		case "Home base":
			return "작전 거점";
		case "Useful info!":
			return "유용한 정보!";
		case "Usable":
			return "사용 가능";
		case "Pushable":
			return "밀 수 있음";
		case "Of Cosmocos":
			return "Cosmocos 출신";
		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(TranslateWesleyScanDetail(node.subText, node.nodeType == 1));
		}
	}

	private static IEnumerable<CodeInstruction> ItemTranspiler(IEnumerable<CodeInstruction> instructions)
	{
		return ReplaceRead(instructions, AccessTools.Field(typeof(Item), "itemName"), "ItemName");
	}

	private 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;
		}
	}

	private static IEnumerable<CodeInstruction> RecipeTranspiler(IEnumerable<CodeInstruction> instructions)
	{
		foreach (CodeInstruction instruction in instructions)
		{
			FieldInfo field = instruction.operand as FieldInfo;
			MethodInfo method = instruction.operand as MethodInfo;
			yield return instruction;
			if (instruction.opcode == OpCodes.Call && method != null && method.Name == "getNameOfIngredient")
			{
				yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ScrapDisplayPlugin), "TranslateCraftingText", (Type[])null, (Type[])null));
			}
			if (instruction.opcode == OpCodes.Ldfld && field != null && field.Name == "Name" && field.DeclaringType.FullName == "WesleysInteriorTools.Features.CraftableItem")
			{
				yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ScrapDisplayPlugin), "RecipeName", (Type[])null, (Type[])null));
			}
		}
	}

	private static IEnumerable<CodeInstruction> CraftingPromptTranspiler(IEnumerable<CodeInstruction> instructions)
	{
		foreach (CodeInstruction instruction in instructions)
		{
			yield return instruction;
			if (instruction.opcode == OpCodes.Ldstr && CraftingText.ContainsKey((string)instruction.operand))
			{
				yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ScrapDisplayPlugin), "TranslateCraftingText", (Type[])null, (Type[])null));
			}
		}
	}

	private static IEnumerable<CodeInstruction> RouteDiscoveryTranspiler(IEnumerable<CodeInstruction> instructions)
	{
		foreach (CodeInstruction instruction in instructions)
		{
			if (instruction.opcode == OpCodes.Ldstr && RouteDiscoveryText.TryGetValue((string)instruction.operand, out var korean))
			{
				instruction.operand = korean;
			}
			yield return instruction;
		}
	}

	private void PatchTerminal(Harmony harmony)
	{
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Expected O, but got Unknown
		translateMoonNames = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "TranslateMoonNames", true, "터미널에는 위성명을 한글로, 함선 모니터와 착륙 안내에는 한글과 영문으로 표시합니다. 끄면 세 화면 모두 영문 이름을 표시합니다.");
		translateTerminalCommands = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "TranslateCommandLabels", true, "터미널에서 Moons, Confirm 등 명령어를 한글로 표시합니다. 한글과 영문 명령어는 항상 사용할 수 있습니다.");
		LoadTerminalTranslations();
		try
		{
			PatchBaconTerminal(harmony);
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("BaconTerminal compatibility could not be installed: " + ex));
		}
		PatchLoreRegistration(harmony);
		PatchTerminalUtils(harmony);
		Type type = AccessTools.TypeByName("LethalLevelLoader.TerminalManager");
		MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "GetSimulationResultsText", (Type[])null, (Type[])null));
		if (methodInfo != null)
		{
			harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateSimulationResults", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
		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);
	}

	private static void TranslateSimulationResults(ref string __result)
	{
		if (!string.IsNullOrEmpty(__result))
		{
			string value;
			__result = SimulationDestination.Replace(__result, delegate(Match match)
			{
				value = match.Groups["planet"].Value;
				return "착륙 시뮬레이션: " + (translateMoonNames.Value ? TranslateMoonLabel(value) : value);
			});
			__result = __result.Replace("Analyzing potential remnants found on surface.", "지표의 구조물 흔적을 분석합니다.").Replace("Listing generated probabilities below.", "구조물별 등장 확률을 표시합니다.").Replace("POSSIBLE STRUCTURES:", "등장 가능한 구조물:");
			__result = SimulationStructure.Replace(__result, (Match match) => (!SimulationDungeonNames.TryGetValue(match.Groups["name"].Value, out value)) ? match.Value : ("* " + value));
		}
	}

	private 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);
		dictionary.Add("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);
	}

	private 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;
	}

	private 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;
		}
	}

	private static string TranslateTerminalInput(string input, Terminal terminal)
	{
		if (string.IsNullOrEmpty(input))
		{
			return input;
		}
		input = NormalizeLguTerminalCommand(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();
					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;
		}
		}
	}

	private 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;
	}

	private 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;
	}

	private static string TranslateMoonLabel(string text)
	{
		return moonDisplayPattern.Replace(text, (Match match) => MoonNounLabel(match.Value));
	}

	private static string TranslateWesleyTerminalLines(string text)
	{
		string value;
		return TerminalLine.Replace(text, (Match match) => (!WesleyTerminalLines.TryGetValue(match.Groups["text"].Value, out value)) ? match.Value : (match.Groups["leading"].Value + value + match.Groups["trailing"].Value));
	}

	private static string TranslateTerminalText(string text, TerminalNode node)
	{
		return LocalizeTerminalPage(text, node, null);
	}

	private static string LocalizeTerminalPage(string text, TerminalNode node, string formatter)
	{
		if (!baconTerminalInstalled