using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using PluginConfig.API; using PluginConfig.API.Decorators; using PluginConfig.API.Fields; using ULTRAKILL.Cheats; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("UltraReprise")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UltraReprise")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d24676a8-4da0-4d43-a77a-48484b462e5c")] [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")] namespace UltraReprise; public static class F_Utils { public class AddresableObject { [CompilerGenerated] private sealed class d__5 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public AddresableObject <>4__this; private AsyncOperationHandle 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) 5__1 = default(AsyncOperationHandle); <>1__state = -2; } private bool MoveNext() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this.obj != null) { return false; } 5__1 = Addressables.LoadAssetAsync((object)<>4__this.path); <>2__current = 5__1; <>1__state = 1; return true; case 1: <>1__state = -1; if ((int)5__1.Status == 1) { <>4__this.fast_load = false; <>4__this.obj = 5__1.Result; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public bool fast_load; public string path; public TObject obj; public TObject Object { get { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (obj == null) { fast_load = true; obj = Addressables.LoadAssetAsync((object)path).WaitForCompletion(); } return obj; } } public Transform[] childs => null; public Transform transform { get { if ((Object)(object)gameObject != (Object)null) { return gameObject.transform; } return null; } } public GameObject gameObject { get { object obj = Object; return (GameObject)((obj is GameObject) ? obj : null); } } [IteratorStateMachine(typeof(AddresableObject<>.d__5))] public IEnumerator Long_Load() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__5(0) { <>4__this = this }; } public T GetComponent() { if ((Object)(object)gameObject != (Object)null) { return gameObject.GetComponent(); } return default(T); } public Transform GetChild(int id) { if ((Object)(object)transform != (Object)null) { return transform.GetChild(id); } return null; } public AddresableObject(string path) { this.path = path; fast_load = false; } public static implicit operator AddresableObject(string path) { return new AddresableObject(path); } public override string ToString() { return path; } } public class Keep_Obj_NearOffset_ThisEnemy : MonoBehaviour { private EnemyIdentifier Eid; public GameObject Obj_ToKeep; public Vector3 Offset = Vector3.zero; public void Start() { Eid = ((Component)this).GetComponent(); if ((Object)(object)Eid == (Object)null) { Eid = ((Component)this).GetComponentInParent(); } if ((Object)(object)Eid == (Object)null) { Eid = ((Component)this).GetComponent().eid; } if ((Object)(object)Eid == (Object)null) { Eid = ((Component)this).GetComponentInParent().eid; } if ((Object)(object)Eid == (Object)null) { Eid = ((Component)((Component)this).transform.parent).GetComponent().eid; } if ((Object)(object)Eid == (Object)null) { Eid = ((Component)((Component)this).transform.parent).GetComponentInParent().eid; } } public void Update() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Obj_ToKeep != (Object)null && (Object)(object)Eid != (Object)null && !Eid.Dead) { Obj_ToKeep.transform.position = ((Component)this).transform.TransformPoint(Offset); } } } public class ActivateWith : MonoBehaviour { public EnemyIdentifier idol; public void Start() { if (Object.op_Implicit((Object)(object)idol)) { ((Component)idol).gameObject.SetActive(true); } } } public class DestroyWith : MonoBehaviour { public EnemyIdentifier eid; public EnemyIdentifier idol; public void Start() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown eid = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)eid) || !Object.op_Implicit((Object)(object)idol)) { return; } eid.onDeath.AddListener((UnityAction)delegate { if ((Object)(object)idol != (Object)null) { Object.Destroy((Object)(object)idol); } }); } } public enum DetectebleEnemies { Idol } public static string[] IgnoreKeys = new string[5] { "fire", "acid", "chainsawzone", "environment", "deathzone" }; public static Dictionary AllEnemiesEids = new Dictionary(); public static Dictionary> AllEnemiesPrefabs = new Dictionary> { [DetectebleEnemies.Idol] = new AddresableObject("Assets/Prefabs/Enemies/Idol.prefab") }; public static bool UltraCheck(EnemyIdentifier eid) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 if (!UltraReprise_Settings.Mod_Enabled || (InvincibleEnemies.Enabled && eid.blessed) || eid.dead || eid.puppet || (int)eid.enemyType == 21 || (int)eid.enemyType == 39) { return true; } return false; } public static void UltraMethod(EnemyIdentifier eid) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) ((Component)eid).gameObject.AddComponent(); Enemy val = default(Enemy); if (((Component)eid).TryGetComponent(ref val)) { Enemy obj = val; obj.health += 1f; } EnemyIdentifier val2 = eid.Make_IdolMerged(enableIdol: true); val2.dontCountAsKills = true; Transform transform = ((Component)val2).transform; transform.localScale *= 0.4f; if (UltraReprise_Settings.Sandify_Idols) { val2.Sandify(false); } } public static float CalculateDamage(float multiplier, float critMultiplier) { return multiplier + multiplier * 1f * critMultiplier; } public static bool Try_GetFrom_Config(BoolField boolField, bool regular = false) { try { if (boolField != null) { return boolField.value; } } catch { } return regular; } public static void DissableColliders(this Transform trf, Transform trc, bool ignore = true) { Collider[] componentsInChildren = ((Component)trf).GetComponentsInChildren(); Collider[] componentsInChildren2 = ((Component)trc).GetComponentsInChildren(); Collider[] array = componentsInChildren; foreach (Collider val in array) { Collider[] array2 = componentsInChildren2; foreach (Collider val2 in array2) { Physics.IgnoreCollision(val, val2, ignore); } } } public static EnemyIdentifier FindEnemyByType(DetectebleEnemies enemy) { EnemyIdentifier value = null; if (AllEnemiesEids.TryGetValue(enemy, out value) && (Object)(object)value != (Object)null) { return value; } if (AllEnemiesPrefabs.TryGetValue(enemy, out var value2)) { value = value2.GetComponent(); if ((Object)(object)value != (Object)null) { AllEnemiesEids.Add(enemy, value); return value; } value = value2.gameObject.GetComponentInChildren(true); if ((Object)(object)value != (Object)null) { AllEnemiesEids.Add(enemy, value); return value; } value = value2.gameObject.GetComponentInParent(true); if ((Object)(object)value != (Object)null) { AllEnemiesEids.Add(enemy, value); return value; } } return null; } public static EnemyIdentifier Integrate_Enemy(DetectebleEnemies enemy, Transform Parent, bool active, Vector3 Pos = default(Vector3), Quaternion Quart = default(Quaternion)) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) EnemyIdentifier val = FindEnemyByType(enemy); GameObject val2 = null; val2 = Object.Instantiate(((Component)((Component)val).transform.root).gameObject, Pos, Quart); val2.transform.root.parent = Parent; val2.transform.position = Pos; val2.transform.rotation = Quart; val2.SetActive(active); KeepInBounds val3 = default(KeepInBounds); if (val2.TryGetComponent(ref val3)) { Object.Destroy((Object)(object)val3); } return val2.GetComponent(); } public static EnemyIdentifier Make_IdolMerged(this EnemyIdentifier eid, bool enableIdol, bool keepNear = true, bool activateWith = false) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) EnemyIdentifier val = Integrate_Enemy(DetectebleEnemies.Idol, ((Component)eid).transform.parent, enableIdol, ((Component)eid).transform.position, ((Component)eid).transform.rotation); val.idol.overrideTarget = eid; ((Component)val).transform.DissableColliders(((Component)eid).transform); if (keepNear) { Keep_Obj_NearOffset_ThisEnemy orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)eid).gameObject); orAddComponent.Obj_ToKeep = ((Component)val).gameObject; ComponentExtensions.GetOrAddComponent((Component)(object)eid).idol = val; } if (activateWith) { ComponentExtensions.GetOrAddComponent((Component)(object)eid).idol = val; } return val; } } public static class UltraReprise_Settings { public static BoolField V__Varb_Mod_Enabled; public static BoolField V__Varb_InstaKill_Enviroment; public static BoolField V__Varb_Sandify_Idols; public static bool Mod_Enabled => F_Utils.Try_GetFrom_Config(V__Varb_Mod_Enabled, regular: true); public static bool InstaKill_Enviroment => F_Utils.Try_GetFrom_Config(V__Varb_InstaKill_Enviroment, regular: true); public static bool Sandify_Idols => F_Utils.Try_GetFrom_Config(V__Varb_Sandify_Idols); } [BepInPlugin("com.enragedone.ultrareprise", "UltraReprise", "1.0.2")] public class UltraReprise_Loader : BaseUnityPlugin { public const string GUID = "com.enragedone.ultrareprise"; public const string Name = "UltraReprise"; public const string Version = "1.0.2"; public const string Set_Guid = "com.enragedone.ultrareprise.settings"; public PluginConfigurator config; public bool Confing_Loaded = false; internal Harmony _Harmony = new Harmony("com.enragedone.fentokill.levelpatches"); public static ManualLogSource _Logger; public static UltraReprise_Loader _Instance; public void Awake() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown _Instance = this; _Logger = ((BaseUnityPlugin)this).Logger; _Logger.LogInfo((object)"UltraReprise_Loader v1.0.2 has started."); try { config = PluginConfigurator.Create("UltraReprise", "com.enragedone.ultrareprise.settings"); string directoryName = Path.GetDirectoryName(typeof(UltraReprise_Loader).Assembly.Location); string text = Path.Combine(directoryName, "icon.png"); config.SetIconWithURL("file://" + text); new ConfigHeader(config.rootPanel, "Main / Global Settings", 24).textColor = Color32.op_Implicit(new Color32((byte)105, (byte)172, byte.MaxValue, byte.MaxValue)); UltraReprise_Settings.V__Varb_Mod_Enabled = new BoolField(config.rootPanel, "Mod Enabled", "com.enragedone.ultrareprise.settings.V__Varb_Mod_Enabled", true); UltraReprise_Settings.V__Varb_InstaKill_Enviroment = new BoolField(config.rootPanel, "InstaKill Enviroment", "com.enragedone.ultrareprise.settings.V__Varb_InstaKill_Enviroment", true); UltraReprise_Settings.V__Varb_Sandify_Idols = new BoolField(config.rootPanel, "Sandify Idols", "com.enragedone.ultrareprise.settings.V__Varb_Sandify_Idols", false); _Logger.LogInfo((object)"Config v1.0.2 loaded successfully"); Confing_Loaded = true; } catch { _Logger.LogError((object)"UltraReprise_Loader v1.0.2 !!!---!!! ERROR With PluginConfigurator Init"); } _Harmony.PatchAll(typeof(Base_Patches)); _Logger.LogInfo((object)"UltraReprise_Loader v1.0.2 loaded successfully without error."); } } public static class Base_Patches { [HarmonyPatch(typeof(Enemy), "GetHurt")] [HarmonyPrefix] public static bool Enemy_GetHurt(Vector3 force, float multiplier, float critMultiplier, EnemyIdentifier ___eid, Enemy __instance) { if (F_Utils.UltraCheck(___eid) || (UltraReprise_Settings.InstaKill_Enviroment && F_Utils.IgnoreKeys.Contains(___eid.hitter))) { return true; } UltraRepriseMarker ultraRepriseMarker = default(UltraRepriseMarker); if (__instance.health - F_Utils.CalculateDamage(multiplier, critMultiplier) < 0.15f && !((Component)__instance).TryGetComponent(ref ultraRepriseMarker)) { F_Utils.UltraMethod(___eid); return false; } return true; } [HarmonyPatch(typeof(Enemy), "HandleParrying")] [HarmonyPostfix] public static void Enemy_HandleParrying(ref DamageData data, EnemyIdentifier ___eid, Enemy __instance) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) UltraRepriseMarker ultraRepriseMarker = default(UltraRepriseMarker); if (!F_Utils.UltraCheck(___eid) && (__instance.health <= 0.1f || __instance.parryable) && !((Component)__instance).TryGetComponent(ref ultraRepriseMarker)) { __instance.health = Mathf.Max(__instance.health, 1f); data.damage = 0f; data.force = Vector3.zero; data.cancel = true; F_Utils.UltraMethod(___eid); } } [HarmonyPatch(typeof(EnemyScript), "OnParry")] [HarmonyPrefix] public static bool EnemyScript_OnParry(EnemyScript __instance) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 EnemyIdentifier component = ((Component)__instance).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || F_Utils.UltraCheck(component) || (int)component.enemyType == 6) { return true; } UltraRepriseMarker ultraRepriseMarker = default(UltraRepriseMarker); if (!((Component)__instance).TryGetComponent(ref ultraRepriseMarker)) { F_Utils.UltraMethod(component); return false; } return true; } [HarmonyPatch(typeof(Streetcleaner), "HandleCanisterHit")] [HarmonyPrefix] public static bool Streetcleaner_HandleCanisterHit(EnemyIdentifier ___eid, Streetcleaner __instance) { if (F_Utils.UltraCheck(___eid)) { return true; } UltraRepriseMarker ultraRepriseMarker = default(UltraRepriseMarker); if (!((Component)__instance).TryGetComponent(ref ultraRepriseMarker)) { F_Utils.UltraMethod(___eid); return false; } return true; } [HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")] [HarmonyPrefix] public static bool EnemyIdentifier_DeliverDamage(Vector3 force, float multiplier, int ___difficulty, EnemyIdentifier __instance) { if (F_Utils.UltraCheck(__instance) || (UltraReprise_Settings.InstaKill_Enviroment && F_Utils.IgnoreKeys.Contains(__instance.hitter))) { return true; } multiplier *= __instance.totalDamageTakenMultiplier; multiplier /= __instance.totalHealthModifier; if (__instance.isBoss && ___difficulty >= 4) { multiplier = ((___difficulty != 5) ? (multiplier / 1.5f) : (multiplier / 2f)); } if (__instance.weaknesses.Length != 0) { for (int i = 0; i < __instance.weaknesses.Length; i++) { if (__instance.hitter == __instance.weaknesses[i] || (__instance.hitterAttributes.Contains((HitterAttribute)2) && __instance.weaknesses[i] == "electricity")) { multiplier *= __instance.weaknessMultipliers[i]; } } } UltraRepriseMarker ultraRepriseMarker = default(UltraRepriseMarker); if (__instance.health - multiplier < 0.15f && !((Component)__instance).TryGetComponent(ref ultraRepriseMarker)) { F_Utils.UltraMethod(__instance); return false; } return true; } [HarmonyPatch(typeof(EnemyIdentifier), "Splatter")] [HarmonyPrefix] public static bool EnemyIdentifier_Splatter(EnemyIdentifier __instance) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (F_Utils.UltraCheck(__instance) || (int)__instance.enemyType == 6 || (UltraReprise_Settings.InstaKill_Enviroment && F_Utils.IgnoreKeys.Contains(__instance.hitter))) { return true; } UltraRepriseMarker ultraRepriseMarker = default(UltraRepriseMarker); if (!((Component)__instance).TryGetComponent(ref ultraRepriseMarker)) { F_Utils.UltraMethod(__instance); return false; } return true; } [HarmonyPatch(typeof(EnemyIdentifier), "Explode")] [HarmonyPrefix] public static bool EnemyIdentifier_Explode(EnemyIdentifier __instance) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (F_Utils.UltraCheck(__instance) || (int)__instance.enemyType == 6 || (UltraReprise_Settings.InstaKill_Enviroment && F_Utils.IgnoreKeys.Contains(__instance.hitter))) { return true; } UltraRepriseMarker ultraRepriseMarker = default(UltraRepriseMarker); if (!((Component)__instance).TryGetComponent(ref ultraRepriseMarker)) { F_Utils.UltraMethod(__instance); return false; } return true; } [HarmonyPatch(typeof(EnemyIdentifier), "ProcessDeath")] [HarmonyPrefix] public static bool EnemyIdentifier_ProcessDeath(EnemyIdentifier __instance) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (F_Utils.UltraCheck(__instance) || (int)__instance.enemyType == 6 || (UltraReprise_Settings.InstaKill_Enviroment && F_Utils.IgnoreKeys.Contains(__instance.hitter))) { return true; } UltraRepriseMarker ultraRepriseMarker = default(UltraRepriseMarker); if (!((Component)__instance).TryGetComponent(ref ultraRepriseMarker)) { F_Utils.UltraMethod(__instance); return false; } return true; } } public class UltraRepriseMarker : MonoBehaviour { }