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 HarderLevels v1.0.0
plugins/RyBirb-HarderLevels/HarderLevels.dll
Decompiled a year agousing System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("HarderLevels")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HarderLevels")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("271f8741-f95c-4beb-970b-22c45d6508aa")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.rybirb.repo.harderlevels", "Harder Levels", "1.0.0")] public class HarderGenerationUltraSafe : BaseUnityPlugin { private static ManualLogSource Log; private static bool isCombatLevel = false; private static string currentLevelName = ""; private static bool injectionDone = false; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"========== [Awake] HarderGenerationUltraSafe Initialized =========="); Harmony.CreateAndPatchAll(typeof(HarderGenerationUltraSafe), (string)null); } [HarmonyPatch(typeof(RunManager), "ChangeLevel")] [HarmonyPostfix] public static void Post_ChangeLevel(RunManager __instance) { Log.LogInfo((object)"========== [RunManager.ChangeLevel] POSTFIX =========="); Level levelCurrent = __instance.levelCurrent; currentLevelName = ((levelCurrent == null) ? null : ((Object)levelCurrent).name?.ToLower()) ?? "NULL"; isCombatLevel = !currentLevelName.Contains("shop") && !currentLevelName.Contains("arena") && !currentLevelName.Contains("lobby"); ManualLogSource log = Log; Level levelCurrent2 = __instance.levelCurrent; log.LogInfo((object)("[Level Name] = " + (((levelCurrent2 != null) ? ((Object)levelCurrent2).name : null) ?? "NULL"))); Log.LogInfo((object)$"[Is Combat Level] = {isCombatLevel}"); Log.LogInfo((object)$"[PhotonNetwork.IsMasterClient] = {PhotonNetwork.IsMasterClient}"); injectionDone = false; Log.LogInfo((object)"[RunManager] Level List:"); if (__instance.levels == null) { Log.LogError((object)"[RunManager] Level list is NULL!"); return; } for (int i = 0; i < __instance.levels.Count; i++) { Level val = __instance.levels[i]; Log.LogInfo((object)string.Format(" [{0}] = {1} | ResourcePath: {2}", i, ((val != null) ? ((Object)val).name : null) ?? "NULL", val?.ResourcePath ?? "NULL")); } } [HarmonyPatch(typeof(LevelGenerator), "Start")] [HarmonyPostfix] public static void Post_LevelGeneratorStart(LevelGenerator __instance) { Log.LogInfo((object)"========== [LevelGenerator.Start] POSTFIX =========="); if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)"[Abort] Not host. Skipping level injection."); return; } if (!isCombatLevel) { Log.LogInfo((object)"[Abort] Not a combat level. Skipping injection."); return; } if (injectionDone) { Log.LogInfo((object)"[Abort] Injection already done."); return; } Level val = RunManager.instance?.levelCurrent; if ((Object)(object)val == (Object)null) { Log.LogError((object)"[Abort] RunManager.levelCurrent is NULL."); return; } __instance.Level = val; Log.LogInfo((object)("[Level Assigned] " + ((Object)val).name)); Log.LogInfo((object)("[ResourcePath] " + val.ResourcePath)); Log.LogInfo((object)("[NarrativeName] " + val.NarrativeName)); DumpAndInject(val.ModulesNormal3, val.ModulesNormal1, "ModulesNormal"); DumpAndInject(val.ModulesPassage3, val.ModulesPassage1, "ModulesPassage"); DumpAndInject(val.ModulesDeadEnd3, val.ModulesDeadEnd1, "ModulesDeadEnd"); DumpAndInject(val.ModulesExtraction3, val.ModulesExtraction1, "ModulesExtraction"); injectionDone = true; Log.LogInfo((object)"========== [LevelGenerator] Injection Complete =========="); } private static void DumpAndInject(List<GameObject> src, List<GameObject> dest, string label) { Log.LogInfo((object)("------ [Injection Start] " + label + " ------")); if (src == null || dest == null) { Log.LogWarning((object)("[Injection] " + label + "3 or " + label + "1 is NULL. Skipping.")); return; } Log.LogInfo((object)$"[{label}3] Count: {src.Count}"); Log.LogInfo((object)$"[{label}1] Count (before clear): {dest.Count}"); bool flag = true; for (int i = 0; i < src.Count; i++) { GameObject val = src[i]; if ((Object)(object)val == (Object)null) { Log.LogError((object)$"[{label}3] Null prefab at index {i}."); flag = false; continue; } Log.LogInfo((object)$"[{label}3] Prefab {i}: {((Object)val).name} | ChildCount: {val.transform.childCount}"); } if (!flag) { Log.LogWarning((object)("[Injection] " + label + "3 contains invalid prefabs. Injection skipped.")); return; } dest.Clear(); dest.AddRange(src); Log.LogInfo((object)$"[Injection] Copied {src.Count} prefabs from {label}3 to {label}1."); Log.LogInfo((object)$"[{label}1] Count (after injection): {dest.Count}"); Log.LogInfo((object)("------ [Injection End] " + label + " ------")); } }