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.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using BillionDifficulty.EnemyPatches; using Configgy; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using ULTRAKILL.Cheats; using ULTRAKILL.Enemy; using ULTRAKILL.Portal; using UnityEngine; using UnityEngine.AI; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BillionDifficulty")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("2.1.1.0")] [assembly: AssemblyInformationalVersion("2.1.1+fb660c27184355245c5aadd8dd1e4239dc6cf11f")] [assembly: AssemblyProduct("Billion Difficulty")] [assembly: AssemblyTitle("BillionDifficulty")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BillionDifficulty { public class Util { public static bool IsDifficulty(int difficulty) { return MonoSingleton.Instance.GetInt("difficulty", 0) == difficulty; } public static int GetDifficulty() { return MonoSingleton.Instance.GetInt("difficulty", 0); } public static bool IsHardMode() { return ((ConfigValueElement)(object)Plugin.IsBrilliantBillion).Value && IsDifficulty(19); } public static T[] AddToArray(ref T[] array, T element, int index = -1) { if (index == -1) { index = array.Length; } List list = array.ToList(); list.Insert(index, element); array = list.ToArray(); return array; } public static T[] AddToArray(ref T[] array, T[] elements, int index = -1) { if (index == -1) { index = array.Length; } int num = 0; int num2 = index; List list = array.ToList(); while (num < elements.Length) { list.Insert(num2, elements[num]); num++; num2++; } array = list.ToArray(); return array; } public static Texture2D LoadEmbeddedTexture(string resourceName) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream(resourceName); if (stream == null) { Plugin.Logger.LogError((object)("Embedded resource '" + resourceName + "' not found")); return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { return val; } Plugin.Logger.LogError((object)"Failed to load embedded texture"); return null; } } [BepInPlugin("billy.billiondifficulty", "Billion Difficulty", "2.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("ULTRAKILL.exe")] public class Plugin : BaseUnityPlugin { private ConfigBuilder config; [Configgable("", "Brilliant Billion mode", 0, "A very difficult mode intended to make the main campaign a lot harder (doesn't properly update enemies that are already spawned)")] public static ConfigToggle IsBrilliantBillion = new ConfigToggle(false); public static bool StayedOnHardMode = false; public const int BlueFilthRarity = 250; private static readonly Harmony Harmony = new Harmony("billy.billiondifficulty"); internal static ManualLogSource Logger; private static bool loadedAssets = false; public static Texture2D blueFilthTexture = Util.LoadEmbeddedTexture("BillionDifficulty.assets.zombie_MeleeHusk_MouthOpen_Diffuse.png"); public static Texture2D blueFilthBiteTexture = Util.LoadEmbeddedTexture("BillionDifficulty.assets.zombie_MeleeHusk_MouthClosed_Diffuse.png"); public static Dictionary Prefabs = new Dictionary { ["ProjectileExplosiveHH"] = null, ["ProjectileHoming"] = null, ["Projectile"] = null, ["GasolineProjectile"] = null, ["ExplosionSuper"] = null, ["Explosion"] = null, ["PumpChargeSound"] = null, ["MirrorReaperGroundWave"] = null, ["ProjectileHomingAcid"] = null, ["ProjectileHomingExplosive"] = null, ["ProjectileMinosPrimeSnake"] = null, ["ExplosionSisyphusPrimeCharged"] = null, ["BlackHoleEnemy"] = null, ["VirtueInsignia"] = null, ["GeryonForwardArrowBeam"] = null, ["PhysicalShockwave"] = null, ["GoopLarge"] = null, ["GoopLargeLong"] = null }; public static AudioClip PumpCharge = null; public void Awake() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Harmony.PatchAll(); Logger.LogInfo((object)"Plugin BillionDifficulty is loaded! WOAHHHH"); SceneManager.activeSceneChanged += SceneManagerActiveSceneChanged; GetAssets(); config = new ConfigBuilder("billy.billiondifficulty", "Billion Difficulty"); ConfigToggle isBrilliantBillion = IsBrilliantBillion; ((ConfigValueElement)(object)isBrilliantBillion).OnValueChanged = (Action)Delegate.Combine(((ConfigValueElement)(object)isBrilliantBillion).OnValueChanged, new Action(HardModeValueChanged)); config.BuildAll(); } public void SceneManagerActiveSceneChanged(Scene arg0, Scene arg1) { if (SceneHelper.CurrentScene == "Main Menu") { AddDifficultyButton(); } StayedOnHardMode = Util.IsHardMode(); } public static void HardModeValueChanged(bool v) { string text = (v ? "BRILLIANT BILLION" : "BILLION"); StayedOnHardMode = false; if (SceneHelper.CurrentScene != "Main Menu") { text = "BILLION"; } DifficultyTitle[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (DifficultyTitle val in array) { val.Check(); } PresenceController val2 = Object.FindAnyObjectByType(); if ((Object)(object)val2 != (Object)null && val2.diffNames.Length >= 20 && !(text == val2.diffNames[19])) { val2.diffNames[19] = text; DiscordController val3 = Object.FindAnyObjectByType(); if (val3 != null) { val3.FetchSceneActivity(SceneHelper.CurrentScene); } SteamController val4 = Object.FindAnyObjectByType(); if (val4 != null) { val4.FetchSceneActivity(SceneHelper.CurrentScene); } } } public static T Ass(string path) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Addressables.LoadAssetAsync((object)path).WaitForCompletion(); } public static void GetAssets() { if (!loadedAssets) { Prefabs["ProjectileExplosiveHH"] = Ass("Assets/Prefabs/Attacks and Projectiles/Projectile Explosive HH.prefab"); Prefabs["ProjectileHoming"] = Ass("Assets/Prefabs/Attacks and Projectiles/Projectile Homing.prefab"); Prefabs["Projectile"] = Ass("Assets/Prefabs/Attacks and Projectiles/Projectile.prefab"); Prefabs["GasolineProjectile"] = Ass("Assets/Prefabs/Attacks and Projectiles/GasolineProjectile.prefab"); Prefabs["ExplosionSuper"] = Ass("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion Super.prefab"); Prefabs["Explosion"] = Ass("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion.prefab"); Prefabs["PumpChargeSound"] = Ass("Assets/Particles/SoundBubbles/PumpChargeSound.prefab"); PumpCharge = Ass("Assets/Sounds/Weapons/pumpCharge.wav"); Prefabs["MirrorReaperGroundWave"] = Ass("Assets/Prefabs/Attacks and Projectiles/MirrorReaperGroundWave.prefab"); Prefabs["ProjectileHomingAcid"] = Ass("Assets/Prefabs/Attacks and Projectiles/Projectile Homing Acid.prefab"); ((Component)Prefabs["ProjectileHomingAcid"].transform.Find("GoopCloud")).gameObject.AddComponent(); ((Component)Prefabs["ProjectileHomingAcid"].transform.Find("GoopCloud")).GetComponent().time = 10f; Prefabs["ProjectileHomingExplosive"] = Ass("Assets/Prefabs/Attacks and Projectiles/Projectile Homing Explosive.prefab"); Prefabs["ProjectileMinosPrimeSnake"] = Ass("Assets/Prefabs/Attacks and Projectiles/Projectile Minos Prime Snake.prefab"); Prefabs["ExplosionSisyphusPrimeCharged"] = Ass("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion Sisyphus Prime Charged.prefab"); Prefabs["BlackHoleEnemy"] = Ass("Assets/Prefabs/Attacks and Projectiles/Black Hole Enemy.prefab"); Prefabs["VirtueInsignia"] = Ass("Virtue Insignia"); Prefabs["GeryonForwardArrowBeam"] = Ass("Assets/Prefabs/Attacks and Projectiles/GeryonForwardArrowBeam.prefab"); Prefabs["PhysicalShockwave"] = Ass("Assets/Prefabs/Attacks and Projectiles/PhysicalShockwave.prefab"); Prefabs["GoopLarge"] = Ass("Assets/Prefabs/Attacks and Projectiles/GoopLarge.prefab"); Prefabs["GoopLargeLong"] = Ass("Assets/Prefabs/Attacks and Projectiles/GoopLargeLong.prefab"); loadedAssets = true; } } public Transform FindCanvas() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); return (from obj in ((Scene)(ref activeScene)).GetRootGameObjects() where ((Object)obj).name == "Canvas" select obj).First().transform; } public void AddDifficultyButton() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) Transform val = FindCanvas(); Transform val2 = val.Find("Difficulty Select (1)").Find("Interactables"); Transform transform = Object.Instantiate(((Component)val2.Find("Brutal")).gameObject, val2).transform; DifficultySelectButton component = ((Component)transform).GetComponent(); component.difficulty = 19; transform.position += new Vector3(700f, 82.5f); TextMeshProUGUI component2 = ((Component)transform.Find("Name")).GetComponent(); ((TMP_Text)component2).text = "BILLION"; ((Graphic)component2).color = Color.white; Button component3 = ((Component)component).GetComponent