Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Level Renamed v1.0.0
LevelRename.dll
Decompiled 5 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LevelRename")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LevelRename")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("456a3c1b-eaed-4251-88ab-7174082cb87b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace LevelRename; [BepInPlugin("com.alpakatitikaka.levelrename", "Level Rename", "1.0.0")] public class LevelRenamePatchMod : BaseUnityPlugin { [HarmonyPatch(typeof(LoadingUI), "LevelAnimationStart")] internal static class LevelNamePatch { private static void Postfix(LoadingUI __instance) { if (!((Object)(object)__instance?.levelNameText == (Object)null)) { string text = ((TMP_Text)__instance.levelNameText).text; if (!Names.TryGetValue(((TMP_Text)__instance.levelNameText).text, out var value) && !__ref.TryGetValue(((TMP_Text)__instance.levelNameText).text, out value)) { value = text; } ((TMP_Text)__instance.levelNameText).text = value; ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("Level " + text + " renamed to " + value)); } } } private static readonly Dictionary<string, string> Names = new Dictionary<string, string>(); private static readonly Dictionary<string, string> __ref = new Dictionary<string, string> { { "Swiftbroom Academy", "АКАДЕМИЯ СВИФТБУМ" }, { "Headman Manor", "ПОМЕСТЬЕ ЛЫСОГО" }, { "McJannek Station", "СТАНЦИЯ МАНАЖЕК" }, { "Museum of Human Art", "МУЗЭЙ" }, { "Hoping Hospital", "ПСИХ. ЛЕЧЕБНИЦА" }, { "Winter Cabin", "ЗИМНЯЯ ХИЖИНА" }, { "Deeproot Garden", "ЗАБРОШЕННЫЙ САД" }, { "Service Station", "ШОПИК" }, { "Disposal Arena", "ОРЭНА" } }; private string allInitialNames = ""; public static LevelRenamePatchMod Instance { get; private set; } public static ConfigEntry<string> LevelNames { get; private set; } private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) Instance = this; new Harmony("com.alpakatitikaka.levelrename").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Level Rename Mod loaded!"); } private void Update() { if (Utility.IsNullOrWhiteSpace(allInitialNames)) { loadLevels(); if (!Utility.IsNullOrWhiteSpace(allInitialNames)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Levels loaded!"); setupConfig(); setNames(); } } } private void setupConfig() { LevelNames = ((BaseUnityPlugin)this).Config.Bind<string>("General", "LevelNames", "", "Вводите новые названия уровней через запятую: имя1-имя2,имя3-имя4\nСуществующие уровни: " + allInitialNames); ((BaseUnityPlugin)this).Config.SettingChanged += onChanged; } private void onChanged(object sender, EventArgs e) { setNames(); } private string[] cleanLevelName(string dirt) { return dirt.Trim().Split(new char[1] { '-' }); } private void copyDictionaryToDictionary<K, V>(Dictionary<K, V> dict1, Dictionary<K, V> dict2) { foreach (KeyValuePair<K, V> item in dict1) { dict2.Add(item.Key, item.Value); } } private void setNames() { if (LevelNames == null) { return; } string value = LevelNames.Value; if (Utility.IsNullOrWhiteSpace(value)) { copyDictionaryToDictionary(__ref, Names); return; } Names.Clear(); string[] array = value.Split(new char[1] { ',' }); foreach (string dirt in array) { string[] array2 = cleanLevelName(dirt); if (array2.Length != 2) { ((BaseUnityPlugin)this).Logger.LogError((object)"Bad level name format"); continue; } string text = array2[0]; string text2 = array2[1]; Names.Add(text, text2); ((BaseUnityPlugin)this).Logger.LogInfo((object)(text2 + " binded to level " + text)); } } private void loadLevels() { List<Level> levels = RunManager.instance.levels; if (levels != null) { allInitialNames = string.Join(", ", levels.Select((Level level) => level.NarrativeName).Append("Service Station").Append("Disposal Arena") .Distinct()).TrimEnd(',', ' '); } } }