using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Mod Dev")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Mod Dev")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("edd7670d-f825-4d68-befb-3fc99a3478fb")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("immortalfollower", "Immortal Followers", "1.1.0")] public class ImmortalFollowersPlugin : BaseUnityPlugin { public static ConfigEntry ModEnabled; private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) ModEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enable Immortality", true, "Whether to enable immortality"); new Harmony("Immortal Followers").PatchAll(); } public static void MakeImmortal(FollowerInfo follower) { if (follower != null && follower.Traits != null && !follower.Traits.Contains((TraitType)32)) { follower.Traits.Add((TraitType)32); } } public static void MakeMortal(FollowerInfo follower) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 if (follower != null && follower.Traits != null) { bool flag = follower.SkinName == "Boss Death Cat"; bool flag2 = (int)follower.Necklace == 127; if (follower.Traits.Contains((TraitType)32) && !flag && !flag2) { follower.Traits.Remove((TraitType)32); } } } public static void ApplyToAll(bool makeImmortal) { if (DataManager.Instance == null) { return; } foreach (FollowerInfo follower in DataManager.Instance.Followers) { if (makeImmortal) { MakeImmortal(follower); } else { MakeMortal(follower); } } foreach (FollowerInfo item in DataManager.Instance.Followers_Recruit) { if (makeImmortal) { MakeImmortal(item); } else { MakeMortal(item); } } } } [HarmonyPatch(typeof(SaveAndLoad), "Load")] public static class SaveAndLoad_Load_Patch { public static void Postfix() { if (ImmortalFollowersPlugin.ModEnabled.Value) { ImmortalFollowersPlugin.ApplyToAll(makeImmortal: true); } else { ImmortalFollowersPlugin.ApplyToAll(makeImmortal: false); } } } [HarmonyPatch(typeof(SaveAndLoad), "Saving")] public static class SaveAndLoad_Saving_Patch { public static void Prefix() { ImmortalFollowersPlugin.ApplyToAll(makeImmortal: false); } public static void Postfix() { if (ImmortalFollowersPlugin.ModEnabled.Value) { ImmortalFollowersPlugin.ApplyToAll(makeImmortal: true); } } } public static class FollowerInfo_NewCharacter_Patch { public static void Postfix(FollowerInfo __result) { if (ImmortalFollowersPlugin.ModEnabled.Value && __result != null) { ImmortalFollowersPlugin.MakeImmortal(__result); } } }