using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using Assets.Scripts.Actors; using Assets.Scripts.Actors.Enemies; using Assets.Scripts.Actors.Player; using Assets.Scripts.Inventory__Items__Pickups; using Assets.Scripts.Inventory__Items__Pickups.AbilitiesPassive; using Assets.Scripts.Inventory__Items__Pickups.Interactables; using Assets.Scripts.Inventory__Items__Pickups.Items; using Assets.Scripts.Inventory__Items__Pickups.Items.ItemImplementations; using Assets.Scripts.Inventory__Items__Pickups.Stats; using Assets.Scripts.Inventory__Items__Pickups.Upgrades; using Assets.Scripts.Inventory__Items__Pickups.Weapons; using Assets.Scripts.Managers; using Assets.Scripts.Menu.Shop; using Assets.Scripts.Saves___Serialization.Progression.Achievements; using Assets.Scripts.Settings___Saves.SaveFiles; using Assets.Scripts.Settings___Saves.SaveFiles.ConfigSaves; using Assets.Scripts.UI.HUD; using Assets.Scripts.UI.InGame.Rewards; using Assets.Scripts._Data; using Assets.Scripts._Data.Tomes; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Inventory__Items__Pickups; using Inventory__Items__Pickups.Xp_and_Levels; using Microsoft.CodeAnalysis; using RizzottoMegamod.Features; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("RizzottoMegamod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RizzottoMegamod")] [assembly: AssemblyTitle("RizzottoMegamod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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 RizzottoMegamod { public static class Diagnostics { private static readonly List _report = new List(); private static readonly List _errors = new List(); public static void Begin(string version) { _report.Clear(); _errors.Clear(); Line("Rizzotto Megamod " + version); Line($"Started at: {DateTime.Now:yyyy-MM-dd HH:mm:ss}"); Line(new string('-', 60)); } public static bool TryApply(ModFeature feature, Harmony harmony) { try { feature.ApplyPatches(harmony); Line($" [ PASS ] {feature.DisplayName,-25} (id: {feature.Id})"); return true; } catch (Exception ex) { Line($" [ FAIL ] {feature.DisplayName,-25} (id: {feature.Id})"); Line(" -> " + ex.GetType().Name + ": " + ex.Message); _errors.Add($"{feature.Id}: {ex}"); for (Exception innerException = ex.InnerException; innerException != null; innerException = innerException.InnerException) { Line(" caused by " + innerException.GetType().Name + ": " + innerException.Message); } return false; } } public static bool VerifyType(string typeName) { try { if (Type.GetType(typeName + ", Assembly-CSharp", throwOnError: false) != null) { return true; } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { if (assemblies[i].GetType(typeName, throwOnError: false) != null) { return true; } } return false; } catch { return false; } } public static void Line(string s) { Plugin.Log.LogInfo((object)s); _report.Add(s); } public static void Warn(string s) { Plugin.Log.LogWarning((object)s); _report.Add("[WARN] " + s); } public static void Error(string s, Exception ex = null) { Plugin.Log.LogError((object)s); _report.Add("[ERROR] " + s); if (ex != null) { _report.Add(" " + ex); _errors.Add(s + ": " + ex); } } public static void Finish(int enabled, int total) { //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown Line(new string('-', 60)); Line($"Result: {enabled}/{total} features enabled, {_errors.Count} error(s)"); if (_errors.Count > 0) { Line(""); Line("ERRORS:"); for (int i = 0; i < _errors.Count; i++) { Line($" ({i + 1}) {_errors[i]}"); } } bool flag = default(bool); try { string text = Path.Combine(Paths.BepInExRootPath, "Megamod_Status.log"); File.WriteAllLines(text, _report); ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Diagnostics] status written to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); } log.LogInfo(val); } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Diagnostics] could not write status file: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log2.LogWarning(val2); } } public static bool TryApplyLeaderboardBlocker(Harmony harmony) { try { LeaderboardBlocker.Init(harmony); Line(" [ PASS ] LeaderboardBlocker (always-on safety)"); return true; } catch (Exception ex) { Line(" [ FAIL ] LeaderboardBlocker (always-on safety)"); Line(" -> " + ex.GetType().Name + ": " + ex.Message); _errors.Add("LeaderboardBlocker: " + ex); return false; } } } public static class EnumLists { public static readonly string[] Tomes = new string[27] { "Agility", "Armor", "Attraction", "Balance", "Blood", "Bounce", "Chaos", "Cooldown", "Cursed", "Damage", "Duration", "Evasion", "Gambler", "Golden", "Health", "Hoarder", "Knockback", "Luck", "Precision", "ProjectileSpeed", "Quantity", "Regeneration", "Shield", "Silver", "Size", "Thorns", "Xp" }; public static readonly HashSet HiddenTomes = new HashSet { "Balance", "Bounce", "Gambler", "Hoarder" }; public static readonly string[] Characters = new string[21] { "Fox", "Calcium", "SirOofie", "Cl4nk", "Megachad", "Ogre", "Robinette", "Athena", "Birdo", "Bush", "Bandit", "Monke", "Noelle", "TonyMcZoom", "Amog", "Spaceman", "Ninja", "Vlad", "Dicehead", "SirChadwell", "Roberto" }; public static readonly string[] Items = new string[88] { "Key", "Beer", "SpikyShield", "Bonker", "SlipperyRing", "CowardsCloak", "GymSauce", "Battery", "PhantomShroud", "ForbiddenJuice", "DemonBlade", "GrandmasSecretTonic", "GiantFork", "MoldyCheese", "GoldenSneakers", "SpicyMeatball", "Chonkplate", "LightningOrb", "IceCube", "DemonicBlood", "DemonicSoul", "BeefyRing", "Dragonfire", "GoldenGlove", "GoldenShield", "ZaWarudo", "OverpoweredLamp", "Feathers", "Ghost", "SluttyCannon", "TurboSocks", "ShatteredWisdom", "EchoShard", "SuckyMagnet", "Backpack", "Clover", "Campfire", "Rollerblades", "Skuleg", "EagleClaw", "Scarf", "Anvil", "Oats", "CursedDoll", "EnergyCore", "ElectricPlug", "BobDead", "SoulHarvester", "Mirror", "JoesDagger", "WeebHeadset", "SpeedBoi", "Gasmask", "ToxicBarrel", "HolyBook", "BrassKnuckles", "IdleJuice", "Kevin", "Borgar", "Medkit", "GamerGoggles", "UnstableTransfusion", "BloodyCleaver", "CreditCardRed", "CreditCardGreen", "BossBuster", "LeechingCrystal", "TacticalGlasses", "Cactus", "CageKey", "IceCrystal", "TimeBracelet", "GloveLightning", "GlovePoison", "GloveBlood", "GloveCurse", "GlovePower", "Wrench", "Beacon", "GoldenRing", "QuinsMask", "CryptKey", "OldMask", "Snek", "Pot", "BobsLantern", "Pumpkin", "WizardsHat" }; public static readonly string[][] ItemAliases = new string[7][] { new string[2] { "burger", "Borgar" }, new string[2] { "hamburger", "Borgar" }, new string[2] { "hourglass", "ZaWarudo" }, new string[2] { "op lamp", "OverpoweredLamp" }, new string[2] { "big bonk", "Bonker" }, new string[2] { "slurp gloves", "GloveBlood" }, new string[2] { "thunder mitts", "GloveLightning" } }; public static readonly string[] Hotkeys = new string[73] { "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "Insert", "Home", "PageUp", "PageDown", "End", "Delete", "Keypad0", "Keypad1", "Keypad2", "Keypad3", "Keypad4", "Keypad5", "Keypad6", "Keypad7", "Keypad8", "Keypad9", "KeypadPlus", "KeypadMinus", "KeypadDivide", "KeypadMultiply", "KeypadEnter", "Tab", "CapsLock", "Backspace", "Return", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "A", "S", "D", "F", "G", "H", "J", "K", "L", "Z", "X", "C", "V", "B", "N", "M", "Alpha0", "Alpha1", "Alpha2", "Alpha3", "Alpha4", "Alpha5", "Alpha6", "Alpha7", "Alpha8", "Alpha9" }; } public static class LeaderboardBlocker { public static void Init(Harmony harmony) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0047: Expected O, but got Unknown harmony.PatchAll(typeof(LeaderboardUploadPatches)); VerifyPatched("QueueLeaderboardUpload"); VerifyPatched("UploadLeaderboardScore"); try { ClassInjector.RegisterTypeInIl2Cpp(); GameObject val = new GameObject("Megamod_LeaderboardToggleBlocker") { hideFlags = (HideFlags)61 }; val.AddComponent(); Object.DontDestroyOnLoad((Object)val); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[LeaderboardBlocker] toggle-blocker spawn failed: " + ex.Message)); } Plugin.Log.LogInfo((object)"LeaderboardBlocker active — leaderboard uploads are suppressed."); } private static void VerifyPatched(string methodName) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(SteamLeaderboardsManagerNew), methodName, (Type[])null, (Type[])null); bool flag = default(bool); if (methodInfo == null) { ManualLogSource log = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(100, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[LeaderboardBlocker] target '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(methodName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' not found — UPLOAD MAY NOT BE BLOCKED. Game version may have changed."); } log.LogError(val); return; } Patches patchInfo = Harmony.GetPatchInfo((MethodBase)methodInfo); if (patchInfo == null || patchInfo.Prefixes.Count == 0) { ManualLogSource log2 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(77, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[LeaderboardBlocker] prefix did not attach to '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(methodName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' — UPLOAD MAY NOT BE BLOCKED."); } log2.LogError(val); return; } ManualLogSource log3 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(64, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[LeaderboardBlocker] verified prefix on "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(methodName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(patchInfo.Prefixes.Count); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" prefix(es) attached)."); } log3.LogInfo(val2); } } public class LeaderboardToggleBlocker : MonoBehaviour { private float _toastTimer; private GUIStyle _toastBox; private GUIStyle _toastText; private bool _stylesReady; private int _scanCounter; public LeaderboardToggleBlocker(IntPtr ptr) : base(ptr) { } private void Update() { try { SaveManager instance = SaveManager.Instance; object obj; if (instance == null) { obj = null; } else { ConfigSaveFile config = instance.config; obj = ((config != null) ? config.cfGameSettings : null); } CFGameSettings val = (CFGameSettings)obj; if (val != null && val.upload_score_to_leaderboard != 0) { val.upload_score_to_leaderboard = 0; _toastTimer = 4f; } if (_toastTimer > 0f) { _toastTimer -= Time.unscaledDeltaTime; } if ((_scanCounter++ & 7) == 0) { ForceVisualToggleOff(); } } catch { } } private void ForceVisualToggleOff() { try { Il2CppArrayBase val = Object.FindObjectsOfType(); for (int i = 0; i < val.Length; i++) { BetterSetting val2 = val[i]; if (!((Object)(object)val2 == (Object)null) && IsLeaderboardRow(val2) && !val2.IsDisabled()) { val2.Disable("Can't Enable with Megamod"); } } } catch { } } private static bool IsLeaderboardRow(BetterSetting row) { try { TextMeshProUGUI settingName = row.settingName; if ((Object)(object)settingName != (Object)null && (((TMP_Text)settingName).text ?? "").ToLowerInvariant().Contains("upload")) { return true; } } catch { } Transform val = ((Component)row).transform; for (int i = 0; i < 6; i++) { if (!((Object)(object)val != (Object)null)) { break; } string text = (((Object)val).name ?? "").ToLowerInvariant(); if (text.Contains("upload_score") || text.Contains("uploadscore") || text.Contains("upload ")) { return true; } val = val.parent; } return false; } private void OnGUI() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (!(_toastTimer <= 0f)) { EnsureStyles(); float num = ((float)Screen.width - 460f) / 2f; float num2 = 60f; int depth = GUI.depth; GUI.depth = -2000; float num3 = Mathf.Min(1f, _toastTimer / 0.8f); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, num3); GUI.Box(new Rect(num, num2, 460f, 56f), GUIContent.none, _toastBox); GUI.Label(new Rect(num, num2, 460f, 56f), "Can't Enable with Megamod", _toastText); GUI.color = color; GUI.depth = depth; } } private void EnsureStyles() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown if (!_stylesReady || _toastBox == null || _toastBox.normal == null || (Object)(object)_toastBox.normal.background == (Object)null) { _stylesReady = true; GUIStyle val = new GUIStyle(); val.normal.background = MakeTex(new Color(0.12f, 0.05f, 0.05f, 1f)); _toastBox = val; GUIStyle val2 = new GUIStyle { fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val2.normal.textColor = new Color(1f, 0.6f, 0.6f); _toastText = val2; } } private static Texture2D MakeTex(Color c) { //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) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0025: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, c); val.Apply(); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); return val; } } public static class LeaderboardUploadPatches { [HarmonyPatch(typeof(SteamLeaderboardsManagerNew), "QueueLeaderboardUpload")] [HarmonyPrefix] private static bool QueueUpload_Prefix() { return false; } [HarmonyPatch(typeof(SteamLeaderboardsManagerNew), "UploadLeaderboardScore")] [HarmonyPrefix] private static bool UploadScore_Prefix() { return false; } } public class MegaMenu : MonoBehaviour { private sealed class HotkeyRow { public string Item = "Anvil"; public int Amount = 5; public string Key = "F9"; public string Search = "Anvil"; } public static ConfigEntry ToggleKey; private static MegaMenu _instance; private bool _open; private Vector2 _scroll; private string _itemSearch = ""; private readonly Dictionary _expanded = new Dictionary(); private readonly List _hotkeyRows = new List(); private bool _hotkeyRowsLoaded; private string _assignTarget = ""; private int _amountEditTarget = -1; private string _amountEditBuffer = ""; private string _configIntId = ""; private string _configIntBuffer = ""; private ConfigEntry _configIntEntry; private int _configIntMin = 1; private int _configIntMax = int.MaxValue; private string _configFloatId = ""; private string _configFloatBuffer = ""; private ConfigEntry _configFloatEntry; private float _configFloatMin; private float _configFloatMax = 1f; private float _savedTimeScale = 1f; private CursorLockMode _savedCursorLock; private bool _savedCursorVisible = true; private readonly List _suppressedRaycasters = new List(); private GUIStyle _box; private GUIStyle _header; private GUIStyle _label; private GUIStyle _dim; private GUIStyle _btn; private GUIStyle _accent; private GUIStyle _danger; private GUIStyle _textfield; private GUIStyle _backdrop; private bool _stylesReady; private const float WIN_W = 720f; private const float WIN_H = 820f; private const float PAD = 14f; private const float ROW_H = 28f; private const float ROW_GAP = 4f; private const float HEADER_H = 60f; private const float FOOTER_H = 50f; private const float MENU_CARD_H = 90f; private const float SLIDER_LABEL_W = 240f; private const int HK_MAX_MATCHES = 8; private const int HK_MATCH_COLS = 4; public static bool IsOpen { get { if ((Object)(object)_instance != (Object)null) { return _instance._open; } return false; } } public MegaMenu(IntPtr ptr) : base(ptr) { } private void Awake() { _instance = this; } public static void BindConfig(ConfigFile cfg) { ToggleKey = cfg.Bind("Menu", "ToggleKey", (KeyCode)282, "Key that opens / closes the in-game megamod menu."); } private void Update() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(_assignTarget)) { KeyCode val = ScanFirstKey(); if ((int)val != 0) { ApplyAssignedKey(val); _assignTarget = ""; } return; } if (Input.GetKeyDown(ToggleKey.Value)) { Toggle(); } if (_open && Input.GetKeyDown((KeyCode)27)) { Toggle(); } if (!_open || !string.IsNullOrEmpty(_assignTarget)) { return; } string inputString = Input.inputString; if (inputString.Length <= 0) { return; } bool flag = _amountEditTarget >= 0 && _amountEditTarget < _hotkeyRows.Count; bool flag2 = _configIntId.Length > 0 && _configIntEntry != null; bool flag3 = _configFloatId.Length > 0 && _configFloatEntry != null; for (int i = 0; i < inputString.Length; i++) { char c = inputString[i]; if (flag) { switch (c) { case '\b': if (_amountEditBuffer.Length > 0) { _amountEditBuffer = _amountEditBuffer.Substring(0, _amountEditBuffer.Length - 1); } break; case '\n': case '\r': CommitAmountEdit(); flag = false; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (_amountEditBuffer.Length < 6) { _amountEditBuffer += c; } break; } continue; } if (flag2) { switch (c) { case '\b': if (_configIntBuffer.Length > 0) { _configIntBuffer = _configIntBuffer.Substring(0, _configIntBuffer.Length - 1); } break; case '\n': case '\r': CommitConfigIntEdit(); flag2 = false; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (_configIntBuffer.Length < 6) { _configIntBuffer += c; } break; } continue; } if (flag3) { switch (c) { case '\b': if (_configFloatBuffer.Length > 0) { _configFloatBuffer = _configFloatBuffer.Substring(0, _configFloatBuffer.Length - 1); } continue; case '\n': case '\r': CommitConfigFloatEdit(); flag3 = false; continue; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (_configFloatBuffer.Length < 8) { _configFloatBuffer += c; continue; } break; } if (c == '.' && !_configFloatBuffer.Contains('.') && _configFloatBuffer.Length < 7) { if (_configFloatBuffer.Length == 0) { _configFloatBuffer = "0"; } _configFloatBuffer += c; } continue; } switch (c) { case '\b': if (_itemSearch.Length > 0) { _itemSearch = _itemSearch.Substring(0, _itemSearch.Length - 1); } break; case ' ': case '!': case '"': case '#': case '$': case '%': case '&': case '\'': case '(': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case ':': case ';': case '<': case '=': case '>': case '?': case '@': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case '\\': case ']': case '^': case '_': case '`': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case '{': case '|': case '}': case '~': _itemSearch += c; break; } } } private void CommitAmountEdit() { if (_amountEditTarget < 0 || _amountEditTarget >= _hotkeyRows.Count) { _amountEditTarget = -1; _amountEditBuffer = ""; return; } if (_amountEditBuffer.Length > 0 && int.TryParse(_amountEditBuffer, out var result) && result >= 1) { _hotkeyRows[_amountEditTarget].Amount = result; FlushHotkeyRowsToConfig(); } _amountEditTarget = -1; _amountEditBuffer = ""; } private void CommitConfigIntEdit() { if (_configIntEntry != null && _configIntBuffer.Length > 0 && int.TryParse(_configIntBuffer, out var result)) { _configIntEntry.Value = Mathf.Clamp(result, _configIntMin, _configIntMax); } _configIntId = ""; _configIntBuffer = ""; _configIntEntry = null; } private void CommitConfigFloatEdit() { if (_configFloatEntry != null && _configFloatBuffer.Length > 0 && float.TryParse(_configFloatBuffer, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { _configFloatEntry.Value = Mathf.Clamp(result, _configFloatMin, _configFloatMax); } _configFloatId = ""; _configFloatBuffer = ""; _configFloatEntry = null; } private void CommitAnyIntEdit() { if (_amountEditTarget >= 0) { CommitAmountEdit(); } if (_configIntId.Length > 0) { CommitConfigIntEdit(); } if (_configFloatId.Length > 0) { CommitConfigFloatEdit(); } } private void Toggle() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) _open = !_open; if (_open) { _savedTimeScale = Time.timeScale; _savedCursorLock = Cursor.lockState; _savedCursorVisible = Cursor.visible; Time.timeScale = 0f; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; SuppressGuiRaycasters(); if (!_hotkeyRowsLoaded) { LoadHotkeyRows(); } } else { CommitAnyIntEdit(); Time.timeScale = _savedTimeScale; Cursor.lockState = _savedCursorLock; Cursor.visible = _savedCursorVisible; RestoreGuiRaycasters(); _assignTarget = ""; } } private void SuppressGuiRaycasters() { try { Il2CppArrayBase val = Object.FindObjectsOfType(); for (int i = 0; i < val.Length; i++) { GraphicRaycaster val2 = val[i]; if ((Object)(object)val2 != (Object)null && ((Behaviour)val2).enabled) { _suppressedRaycasters.Add(val2); ((Behaviour)val2).enabled = false; } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[MegaMenu] could not suppress GraphicRaycasters: " + ex.Message)); } } private void RestoreGuiRaycasters() { for (int i = 0; i < _suppressedRaycasters.Count; i++) { GraphicRaycaster val = _suppressedRaycasters[i]; if ((Object)(object)val != (Object)null) { try { ((Behaviour)val).enabled = true; } catch { } } } _suppressedRaycasters.Clear(); } private static KeyCode ScanFirstKey() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) string[] hotkeys = EnumLists.Hotkeys; for (int i = 0; i < hotkeys.Length; i++) { if (Enum.TryParse(hotkeys[i], out KeyCode result) && Input.GetKeyDown(result)) { return result; } } return (KeyCode)0; } private void ApplyAssignedKey(KeyCode k) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) int result; if (_assignTarget == "menu") { ToggleKey.Value = k; } else if (_assignTarget.StartsWith("hotkey:") && int.TryParse(_assignTarget.Substring(7), out result) && result >= 0 && result < _hotkeyRows.Count) { _hotkeyRows[result].Key = ((object)(KeyCode)(ref k)).ToString(); FlushHotkeyRowsToConfig(); } } private void OnGUI() { if (!_open) { return; } try { Draw(); } catch (Exception ex) { Plugin.Log.LogError((object)("[MegaMenu] OnGUI: " + ex)); } } private void Draw() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) EnsureStyles(); float num = Mathf.Min(720f, (float)(Screen.width - 80)); float num2 = Mathf.Min(820f, (float)(Screen.height - 80)); float num3 = ((float)Screen.width - num) / 2f; float num4 = ((float)Screen.height - num2) / 2f; GUI.depth = -1000; GUI.Box(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), GUIContent.none, _backdrop); GUI.Box(new Rect(num3, num4, num, num2), GUIContent.none, _box); GUI.Label(new Rect(num3 + 14f, num4 + 8f, num - 28f, 32f), "Rizzotto Megamod", _header); GUI.Label(new Rect(num3 + 14f, num4 + 38f, num - 28f, 18f), "Leaderboard submission is permanently disabled while this mod is installed.", _danger); Rect val = default(Rect); ((Rect)(ref val))..ctor(num3 + 14f, num4 + 60f + 6f, num - 28f, num2 - 60f - 50f - 12f); float num5 = ((Rect)(ref val)).width - 20f; float num6 = MeasureContentHeight(num5); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, num5, num6); _scroll = GUI.BeginScrollView(val, _scroll, val2); DrawContent(((Rect)(ref val2)).width); GUI.EndScrollView(); float num7 = num4 + num2 - 50f + 8f; string text = ((!string.IsNullOrEmpty(_assignTarget)) ? "Press any key to bind..." : "Changes apply and save automatically."); GUIStyle val3 = ((!string.IsNullOrEmpty(_assignTarget)) ? _danger : _dim); GUI.Label(new Rect(num3 + 14f, num7, num - 140f, 30f), text, val3); if (GUI.Button(new Rect(num3 + num - 110f, num7, 100f, 30f), "Close", _accent)) { Toggle(); } } private float MeasureContentHeight(float canvasW) { float num = 94f; ModFeature[] features = Plugin.Features; if (features == null) { return num + 28f; } for (int i = 0; i < features.Length; i++) { num += FeatureCardHeight(features[i], canvasW); num += 4f; } return num + 20f; } private float MeasureDescriptionHeight(string description, float innerW) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (_dim == null || string.IsNullOrEmpty(description)) { return 28f; } try { return _dim.CalcHeight(new GUIContent(description), innerW); } catch { return 28f; } } private float FeatureCardHeight(ModFeature f, float canvasW) { float num = 40f; if (!_expanded.TryGetValue(f.Id, out var value) || !value) { return num + 4f; } float num2 = MeasureDescriptionHeight(f.Description, canvasW - 20f); num += num2 + 6f; switch (f.Id) { case "BurgerStat": num += 92f; break; case "BaldForest": num += 32f; break; case "PumpkinStacker": num += 32f; break; case "EliteSlayer": num += SliderRowHeight("Boost multiplier (1.0 = Rizzo's video):") + 4f; break; case "ItemUpgrader": num += SliderRowHeight("Upgrade chance multiplier (1.0 = original):") + 4f; break; case "PotLuck": num += SliderRowHeight("Pot luck multiplier (1.0 = original 0.5%-8% curve):") + 4f; break; case "UnlimitedBanish": num += 64f; break; case "TomeUncap": num += 288f; break; case "MultiPassive": num += 232f; break; case "ItemHotkeys": num += 32f; if (_itemSearch.Length > 0) { num += 66f; } if (_hotkeyRows.Count > 0) { num += 20f; } num += (float)_hotkeyRows.Count * 30f + 8f; break; } return num + 8f; } private void DrawContent(float canvasW) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) float num = 0f; DrawCard(0f, num, canvasW, 90f); GUI.Label(new Rect(8f, num + 8f, canvasW - 16f, 32f), "Menu Hotkey", _header); GUI.Label(new Rect(8f, num + 48f, 220f, 28f), "Open/close the menu with:", _label); Rect rect = new Rect(232f, num + 48f, 140f, 28f); KeyCode value = ToggleKey.Value; DrawAssignKeyButton(rect, "menu", ((object)(KeyCode)(ref value)).ToString()); num += 94f; ModFeature[] features = Plugin.Features; if (features == null) { GUI.Label(new Rect(0f, num, canvasW, 28f), "(features not initialised — Plugin.Load() may have failed)", _danger); return; } for (int i = 0; i < features.Length; i++) { float num2 = FeatureCardHeight(features[i], canvasW); try { DrawFeatureCard(0f, num, canvasW, num2, features[i]); } catch (Exception ex) { GUI.Label(new Rect(8f, num + 4f, canvasW - 16f, 28f), "[error rendering " + features[i].Id + "]: " + ex.Message, _danger); Plugin.Log.LogError((object)("[MegaMenu] feature " + features[i].Id + ": " + ex)); } num += num2 + 4f; } } private void DrawCard(float x, float y, float w, float h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GUI.Box(new Rect(x, y, w, h), GUIContent.none, _box); } private void DrawFeatureCard(float x, float y, float w, float h, ModFeature f) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) DrawCard(x, y, w, h); if (f.Enabled == null) { GUI.Label(new Rect(x + 8f, y + 4f, w - 16f, 28f), "[" + f.Id + "] config not bound", _danger); return; } if (!_expanded.ContainsKey(f.Id)) { _expanded[f.Id] = false; } float num = y + 6f; string text = (f.Enabled.Value ? "[ON]" : "[OFF]"); GUIStyle val = (f.Enabled.Value ? _accent : _btn); if (GUI.Button(new Rect(x + 8f, num, 64f, 28f), text, val)) { f.Enabled.Value = !f.Enabled.Value; if (f.Enabled.Value) { _expanded[f.Id] = true; } } if (GUI.Button(new Rect(x + 78f, num, w - 78f - 88f, 28f), " " + f.DisplayName, _btn)) { _expanded[f.Id] = !_expanded[f.Id]; } bool flag = _expanded[f.Id]; if (GUI.Button(new Rect(x + w - 86f, num, 78f, 28f), flag ? "Hide" : "Show", _btn)) { _expanded[f.Id] = !flag; } if (!flag) { return; } float num2 = y + 28f + 12f; float num3 = MeasureDescriptionHeight(f.Description, w - 20f); GUI.Label(new Rect(x + 10f, num2, w - 20f, num3), f.Description, _dim); float num4 = num2 + num3 + 6f; string id = f.Id; if (id == null) { return; } switch (id.Length) { case 10: switch (id[1]) { case 'u': if (id == "BurgerStat" && f is BurgerStatFeature burgerStatFeature && burgerStatFeature.ChancePerStack != null) { GUI.Label(new Rect(x + 10f, num4, w - 20f, 56f), "Vanilla: 2% chance + 1% per extra Borgar stacked. This mod is linear — each Borgar adds the slider value to the total chance.", _dim); DrawTypeableFloatRow(x + 10f, num4 + 56f + 4f, w - 20f, "Chance per Borgar (0.0 - 1.0):", "burger_chance", burgerStatFeature.ChancePerStack, 0f, 1f); } break; case 'a': if (id == "BaldForest" && f is BaldForestFeature baldForestFeature && baldForestFeature.ExtraShrines != null) { DrawTypeableIntRow(x + 10f, num4, w - 20f, "Extra bald heads per Forest stage:", "baldforest_extra", baldForestFeature.ExtraShrines, 0, 20); } break; } break; case 11: switch (id[0]) { case 'E': if (id == "EliteSlayer" && f is EliteSlayerFeature eliteSlayerFeature && eliteSlayerFeature.BoostMultiplier != null) { DrawSliderRow(x + 10f, num4, w - 20f, "Boost multiplier (1.0 = Rizzo's video):", eliteSlayerFeature.BoostMultiplier, 0.1f, 2f, 0.1f); } break; case 'I': if (id == "ItemHotkeys" && f is ItemHotkeysFeature itemHotkeysFeature && itemHotkeysFeature.Bindings != null) { DrawHotkeyEditor(x + 10f, num4, w - 20f, itemHotkeysFeature.Bindings); } break; } break; case 12: switch (id[0]) { case 'I': if (id == "ItemUpgrader" && f is ItemUpgraderFeature itemUpgraderFeature && itemUpgraderFeature.ChanceMultiplier != null) { DrawSliderRow(x + 10f, num4, w - 20f, "Upgrade chance multiplier (1.0 = original):", itemUpgraderFeature.ChanceMultiplier, 0.1f, 2f, 0.1f); } break; case 'M': if (id == "MultiPassive" && f is MultiPassiveFeature multiPassiveFeature && multiPassiveFeature.ActivePassives != null) { DrawCheckList(x + 10f, num4, w - 20f, "Characters whose passives to grant:", EnumLists.Characters, multiPassiveFeature.ActivePassives); } break; } break; case 14: if (id == "PumpkinStacker" && f is PumpkinStackerFeature pumpkinStackerFeature && pumpkinStackerFeature.StartingPumpkins != null) { DrawTypeableIntRow(x + 10f, num4, w - 20f, "Starting Pumpkins:", "pumpkin_start", pumpkinStackerFeature.StartingPumpkins, 0, 100); } break; case 7: if (id == "PotLuck" && f is PotLuckFeature potLuckFeature && potLuckFeature.LuckMultiplier != null) { DrawSliderRow(x + 10f, num4, w - 20f, "Pot luck multiplier (1.0 = original 0.5%-8% curve):", potLuckFeature.LuckMultiplier, 0.1f, 2f, 0.1f); } break; case 15: if (id == "UnlimitedBanish" && f is UnlimitedBanishFeature unlimitedBanishFeature && unlimitedBanishFeature.Infinite != null && unlimitedBanishFeature.BanishCount != null) { DrawBoolRow(x + 10f, num4, w - 20f, "Infinite (∞ banishes per stage)", unlimitedBanishFeature.Infinite); bool flag2 = !unlimitedBanishFeature.Infinite.Value; DrawTypeableIntRow(x + 10f, num4 + 28f + 4f, w - 20f, "Banishes per stage:", "banish_count", unlimitedBanishFeature.BanishCount, 1, 999, !flag2); } break; case 9: if (id == "TomeUncap" && f is TomeUncapFeature tomeUncapFeature && tomeUncapFeature.UncappedTomes != null) { DrawCheckList(x + 10f, num4, w - 20f, "Tomes to uncap:", EnumLists.Tomes, tomeUncapFeature.UncappedTomes, EnumLists.HiddenTomes); } break; case 8: case 13: break; } } private void DrawBoolRow(float x, float y, float w, string label, ConfigEntry entry) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) string text = (entry.Value ? "[ON]" : "[OFF]"); GUIStyle val = (entry.Value ? _accent : _btn); if (GUI.Button(new Rect(x, y, 64f, 28f), text, val)) { entry.Value = !entry.Value; } GUI.Label(new Rect(x + 72f, y, w - 80f, 28f), label, _label); } private void DrawFloatRow(float x, float y, float w, string label, ConfigEntry entry) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(x, y, w - 200f, 28f), label, _label); GUI.Label(new Rect(x + w - 196f, y, 80f, 28f), entry.Value.ToString("0.00", CultureInfo.InvariantCulture), _label); if (GUI.Button(new Rect(x + w - 110f, y, 32f, 28f), "−", _btn)) { entry.Value = Mathf.Max(0f, entry.Value - 0.01f); } if (GUI.Button(new Rect(x + w - 74f, y, 32f, 28f), "+", _btn)) { entry.Value += 0.01f; } if (GUI.Button(new Rect(x + w - 38f, y, 36f, 28f), "++", _btn)) { entry.Value += 0.1f; } } private float SliderRowHeight(string label) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (_label == null || string.IsNullOrEmpty(label)) { return 28f; } try { return Mathf.Max(28f, _label.CalcHeight(new GUIContent(label), 240f)); } catch { return 28f; } } private void DrawSliderRow(float x, float y, float w, string label, ConfigEntry entry, float min, float max, float step) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) float num = w - 240f - 60f - 8f; if (num < 60f) { num = 60f; } float num2 = SliderRowHeight(label); GUI.Label(new Rect(x, y, 240f, num2), label, _label); float num3 = GUI.HorizontalSlider(new Rect(x + 240f, y + (num2 - 12f) / 2f, num, 12f), entry.Value, min, max); num3 = Mathf.Round(num3 / step) * step; num3 = Mathf.Clamp(num3, min, max); if (Mathf.Abs(num3 - entry.Value) > step / 4f) { entry.Value = num3; } GUI.Label(new Rect(x + 240f + num + 4f, y, 60f, num2), num3.ToString("0.0", CultureInfo.InvariantCulture) + "x", _label); } private void DrawTypeableIntRow(float x, float y, float w, string label, string id, ConfigEntry entry, int min, int max, bool disabled = false) { //IL_000e: 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) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(x, y, w - 200f, 28f), label, disabled ? _dim : _label); bool flag = _configIntId == id && !disabled; Rect val = default(Rect); ((Rect)(ref val))..ctor(x + w - 196f, y, 80f, 28f); GUI.Box(val, GUIContent.none, _textfield); string text = ((!flag) ? entry.Value.ToString() : ((_configIntBuffer.Length == 0) ? "|" : (_configIntBuffer + "|"))); GUI.Label(new Rect(((Rect)(ref val)).x + 6f, ((Rect)(ref val)).y, ((Rect)(ref val)).width - 12f, ((Rect)(ref val)).height), text, disabled ? _dim : _label); if (!disabled && GUI.Button(val, GUIContent.none, GUIStyle.none)) { if (flag) { CommitConfigIntEdit(); } else { CommitAnyIntEdit(); _configIntId = id; _configIntBuffer = ""; _configIntEntry = entry; _configIntMin = min; _configIntMax = max; } } if (disabled) { GUI.Label(new Rect(x + w - 110f, y, 32f, 28f), "−", _dim); GUI.Label(new Rect(x + w - 74f, y, 32f, 28f), "+", _dim); GUI.Label(new Rect(x + w - 38f, y, 36f, 28f), "++", _dim); return; } if (GUI.Button(new Rect(x + w - 110f, y, 32f, 28f), "−", _btn) && entry.Value > min) { CommitAnyIntEdit(); entry.Value -= 1; } if (GUI.Button(new Rect(x + w - 74f, y, 32f, 28f), "+", _btn) && entry.Value < max) { CommitAnyIntEdit(); entry.Value += 1; } if (GUI.Button(new Rect(x + w - 38f, y, 36f, 28f), "++", _btn) && entry.Value < max) { CommitAnyIntEdit(); entry.Value = Mathf.Min(max, entry.Value + 10); } } private void DrawTypeableFloatRow(float x, float y, float w, string label, string id, ConfigEntry entry, float min, float max, float stepSmall = 0.01f, float stepLarge = 0.1f, string format = "0.00") { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(x, y, w - 200f, 28f), label, _label); bool flag = _configFloatId == id; Rect val = default(Rect); ((Rect)(ref val))..ctor(x + w - 196f, y, 80f, 28f); GUI.Box(val, GUIContent.none, _textfield); string text = ((!flag) ? entry.Value.ToString(format, CultureInfo.InvariantCulture) : ((_configFloatBuffer.Length == 0) ? "|" : (_configFloatBuffer + "|"))); GUI.Label(new Rect(((Rect)(ref val)).x + 6f, ((Rect)(ref val)).y, ((Rect)(ref val)).width - 12f, ((Rect)(ref val)).height), text, _label); if (GUI.Button(val, GUIContent.none, GUIStyle.none)) { if (flag) { CommitConfigFloatEdit(); } else { CommitAnyIntEdit(); _configFloatId = id; _configFloatBuffer = ""; _configFloatEntry = entry; _configFloatMin = min; _configFloatMax = max; } } if (GUI.Button(new Rect(x + w - 110f, y, 32f, 28f), "−", _btn) && entry.Value > min) { CommitAnyIntEdit(); entry.Value = Mathf.Max(min, entry.Value - stepSmall); } if (GUI.Button(new Rect(x + w - 74f, y, 32f, 28f), "+", _btn) && entry.Value < max) { CommitAnyIntEdit(); entry.Value = Mathf.Min(max, entry.Value + stepSmall); } if (GUI.Button(new Rect(x + w - 38f, y, 36f, 28f), "++", _btn) && entry.Value < max) { CommitAnyIntEdit(); entry.Value = Mathf.Min(max, entry.Value + stepLarge); } } private void DrawIntRow(float x, float y, float w, string label, ConfigEntry entry) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(x, y, w - 200f, 28f), label, _label); GUI.Label(new Rect(x + w - 196f, y, 80f, 28f), entry.Value.ToString(), _label); if (GUI.Button(new Rect(x + w - 110f, y, 32f, 28f), "−", _btn) && entry.Value > 0) { entry.Value -= 1; } if (GUI.Button(new Rect(x + w - 74f, y, 32f, 28f), "+", _btn)) { entry.Value += 1; } if (GUI.Button(new Rect(x + w - 38f, y, 36f, 28f), "++", _btn)) { entry.Value += 10; } } private void DrawCheckList(float x, float y, float w, string label, string[] options, ConfigEntry csv, HashSet hidden = null) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(x, y, w, 28f), label, _label); string obj = csv.Value ?? ""; HashSet hashSet = new HashSet(); string[] array = obj.Split(','); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length > 0) { hashSet.Add(text); } } float num = (w - 16f) / 3f; bool flag = false; int num2 = 0; foreach (string text2 in options) { if (hidden != null && hidden.Contains(text2)) { continue; } int num3 = num2 / 3; int num4 = num2 % 3; num2++; float num5 = x + (float)num4 * num; float num6 = y + 28f + 4f + (float)num3 * 30f; bool flag2 = hashSet.Contains(text2); string text3 = (flag2 ? "[X] " : "[ ] ") + text2; GUIStyle val = (flag2 ? _accent : _btn); if (GUI.Button(new Rect(num5, num6, num - 6f, 28f), text3, val)) { if (flag2) { hashSet.Remove(text2); } else { hashSet.Add(text2); } flag = true; } } if (!flag) { return; } StringBuilder stringBuilder = new StringBuilder(); for (int k = 0; k < options.Length; k++) { if (hashSet.Contains(options[k])) { if (stringBuilder.Length > 0) { stringBuilder.Append(','); } stringBuilder.Append(options[k]); } } csv.Value = stringBuilder.ToString(); } private void DrawAssignKeyButton(Rect rect, string targetId, string currentKey) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) bool flag = _assignTarget == targetId; string text = (flag ? "Press a key..." : currentKey); GUIStyle val = (flag ? _accent : _btn); if (GUI.Button(rect, text, val)) { if (!flag) { CommitAnyIntEdit(); } _assignTarget = (flag ? "" : targetId); } } private void LoadHotkeyRows() { _hotkeyRows.Clear(); ItemHotkeysFeature itemHotkeysFeature = null; ModFeature[] features = Plugin.Features; if (features != null) { for (int i = 0; i < features.Length; i++) { if (features[i].Id == "ItemHotkeys") { itemHotkeysFeature = (ItemHotkeysFeature)features[i]; break; } } } if (itemHotkeysFeature == null || itemHotkeysFeature.Bindings == null) { _hotkeyRowsLoaded = true; return; } string[] array = (itemHotkeysFeature.Bindings.Value ?? "").Split(';'); for (int j = 0; j < array.Length; j++) { string text = array[j].Trim(); if (text.Length != 0) { string[] array2 = text.Split(':'); if (array2.Length == 3 && int.TryParse(array2[1].Trim(), out var result)) { string text2 = array2[0].Trim(); _hotkeyRows.Add(new HotkeyRow { Item = text2, Amount = result, Key = array2[2].Trim(), Search = text2 }); } } } _hotkeyRowsLoaded = true; } private void DrawHotkeyEditor(float x, float y, float w, ConfigEntry entry) { //IL_001c: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) if (!_hotkeyRowsLoaded) { LoadHotkeyRows(); } float num = y; GUI.Label(new Rect(x, num, 64f, 28f), "Search:", _label); Rect val = default(Rect); ((Rect)(ref val))..ctor(x + 68f, num, w - 68f - 90f, 28f); GUI.Box(val, GUIContent.none, _textfield); bool num2 = _itemSearch.Length > 0; string text = (num2 ? (_itemSearch + "|") : "(type to filter items — Backspace to delete)"); GUIStyle val2 = (num2 ? _label : _dim); GUI.Label(new Rect(((Rect)(ref val)).x + 6f, ((Rect)(ref val)).y, ((Rect)(ref val)).width - 12f, ((Rect)(ref val)).height), text, val2); if (num2 && GUI.Button(new Rect(x + w - 84f, num, 80f, 28f), "Clear", _btn)) { _itemSearch = ""; } num += 32f; if (_itemSearch.Length > 0) { int num3 = 0; float num4 = w / 4f; for (int i = 0; i < EnumLists.Items.Length; i++) { if (num3 >= 8) { break; } if (Matches(EnumLists.Items[i], _itemSearch)) { int num5 = num3 % 4; int num6 = num3 / 4; float num7 = x + (float)num5 * num4; float num8 = num + (float)num6 * 30f; if (GUI.Button(new Rect(num7, num8, num4 - 4f, 28f), EnumLists.Items[i], _btn)) { _hotkeyRows.Add(new HotkeyRow { Item = EnumLists.Items[i], Amount = 1, Key = "F9", Search = EnumLists.Items[i] }); FlushHotkeyRowsToConfig(); _itemSearch = ""; } num3++; } } if (num3 == 0) { GUI.Label(new Rect(x, num, w, 28f), "(no items match \"" + _itemSearch + "\")", _dim); num += 32f; } else { int num9 = (num3 + 4 - 1) / 4; num += (float)num9 * 30f + 6f; } } if (_hotkeyRows.Count > 0) { GUI.Label(new Rect(x, num, 220f, 18f), "Item", _dim); GUI.Label(new Rect(x + 230f, num, 130f, 18f), "Amount", _dim); GUI.Label(new Rect(x + 370f, num, 130f, 18f), "Hotkey", _dim); num += 20f; } Rect val3 = default(Rect); for (int j = 0; j < _hotkeyRows.Count; j++) { HotkeyRow hotkeyRow = _hotkeyRows[j]; GUI.Label(new Rect(x, num, 220f, 28f), hotkeyRow.Item, _label); bool flag = _amountEditTarget == j; ((Rect)(ref val3))..ctor(x + 230f, num, 56f, 28f); GUI.Box(val3, GUIContent.none, _textfield); string text2 = ((!flag) ? hotkeyRow.Amount.ToString() : ((_amountEditBuffer.Length == 0) ? "|" : (_amountEditBuffer + "|"))); GUI.Label(new Rect(((Rect)(ref val3)).x + 6f, ((Rect)(ref val3)).y, ((Rect)(ref val3)).width - 12f, ((Rect)(ref val3)).height), text2, _label); if (GUI.Button(val3, GUIContent.none, GUIStyle.none)) { if (flag) { CommitAmountEdit(); } else { if (_amountEditTarget >= 0) { CommitAmountEdit(); } _amountEditTarget = j; _amountEditBuffer = ""; } } if (GUI.Button(new Rect(x + 290f, num, 28f, 28f), "−", _btn) && hotkeyRow.Amount > 1) { if (_amountEditTarget >= 0) { CommitAmountEdit(); } hotkeyRow.Amount--; FlushHotkeyRowsToConfig(); } if (GUI.Button(new Rect(x + 322f, num, 28f, 28f), "+", _btn)) { if (_amountEditTarget >= 0) { CommitAmountEdit(); } hotkeyRow.Amount++; FlushHotkeyRowsToConfig(); } DrawAssignKeyButton(new Rect(x + 370f, num, 110f, 28f), "hotkey:" + j, hotkeyRow.Key); if (GUI.Button(new Rect(x + 488f, num, 30f, 28f), "X", _btn)) { if (_amountEditTarget == j) { _amountEditTarget = -1; _amountEditBuffer = ""; } else if (_amountEditTarget > j) { _amountEditTarget--; } _hotkeyRows.RemoveAt(j); FlushHotkeyRowsToConfig(); break; } num += 30f; } } private static bool Matches(string itemName, string query) { if (string.IsNullOrEmpty(query)) { return true; } string value = query.ToLowerInvariant(); if (itemName.ToLowerInvariant().Contains(value)) { return true; } string[][] itemAliases = EnumLists.ItemAliases; foreach (string[] array in itemAliases) { if (array.Length == 2 && !(array[1] != itemName) && array[0].ToLowerInvariant().Contains(value)) { return true; } } return false; } private static bool IsExactItem(string s) { for (int i = 0; i < EnumLists.Items.Length; i++) { if (EnumLists.Items[i] == s) { return true; } } return false; } private void FlushHotkeyRowsToConfig() { ItemHotkeysFeature itemHotkeysFeature = null; ModFeature[] features = Plugin.Features; if (features != null) { for (int i = 0; i < features.Length; i++) { if (features[i].Id == "ItemHotkeys") { itemHotkeysFeature = (ItemHotkeysFeature)features[i]; break; } } } if (itemHotkeysFeature == null || itemHotkeysFeature.Bindings == null) { return; } StringBuilder stringBuilder = new StringBuilder(); for (int j = 0; j < _hotkeyRows.Count; j++) { HotkeyRow hotkeyRow = _hotkeyRows[j]; if (!string.IsNullOrEmpty(hotkeyRow.Item) && hotkeyRow.Amount >= 1 && !string.IsNullOrEmpty(hotkeyRow.Key)) { if (stringBuilder.Length > 0) { stringBuilder.Append(';'); } stringBuilder.Append(hotkeyRow.Item).Append(':').Append(hotkeyRow.Amount) .Append(':') .Append(hotkeyRow.Key); } } string text = stringBuilder.ToString(); if (text != itemHotkeysFeature.Bindings.Value) { itemHotkeysFeature.Bindings.Value = text; } } private static Texture2D SolidTex(Color c) { //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) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0025: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, c); val.Apply(); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); return val; } private static RectOffset NewRectOffset(int l, int r, int t, int b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown return new RectOffset { left = l, right = r, top = t, bottom = b }; } private void EnsureStyles() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0163: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Expected O, but got Unknown //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Expected O, but got Unknown //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Expected O, but got Unknown if (!_stylesReady || _box == null || _box.normal == null || (Object)(object)_box.normal.background == (Object)null || _accent == null || _accent.normal == null || (Object)(object)_accent.normal.background == (Object)null || _backdrop == null || _backdrop.normal == null || (Object)(object)_backdrop.normal.background == (Object)null) { _stylesReady = true; GUIStyle val = new GUIStyle(); val.normal.background = SolidTex(new Color(0f, 0f, 0f, 0.6f)); _backdrop = val; GUIStyle val2 = new GUIStyle(GUI.skin.box); val2.normal.background = SolidTex(new Color(0.1f, 0.11f, 0.14f, 1f)); val2.padding = NewRectOffset(10, 10, 8, 8); _box = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 22, fontStyle = (FontStyle)1 }; val3.normal.textColor = new Color(1f, 0.6f, 0.2f); _header = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 14 }; val4.normal.textColor = new Color(0.92f, 0.92f, 0.95f); val4.wordWrap = true; val4.richText = true; val4.alignment = (TextAnchor)3; _label = val4; GUIStyle val5 = new GUIStyle(_label); val5.normal.textColor = new Color(0.6f, 0.62f, 0.68f); _dim = val5; _btn = new GUIStyle(GUI.skin.button) { fontSize = 13, padding = NewRectOffset(8, 8, 4, 4), alignment = (TextAnchor)4 }; GUIStyle val6 = new GUIStyle(_btn) { fontStyle = (FontStyle)1 }; val6.normal.background = SolidTex(new Color(1f, 0.6f, 0.2f)); val6.normal.textColor = Color.black; val6.hover.background = SolidTex(new Color(1f, 0.7f, 0.3f)); val6.hover.textColor = Color.black; val6.active.background = SolidTex(new Color(0.9f, 0.55f, 0.18f)); val6.active.textColor = Color.black; _accent = val6; GUIStyle val7 = new GUIStyle(_label); val7.normal.textColor = new Color(0.9f, 0.35f, 0.35f); val7.fontSize = 11; _danger = val7; GUIStyle val8 = new GUIStyle(GUI.skin.textField) { fontSize = 14 }; val8.normal.textColor = new Color(0.95f, 0.95f, 0.97f); val8.padding = NewRectOffset(6, 6, 4, 4); val8.alignment = (TextAnchor)3; _textfield = val8; } } } public abstract class ModFeature { public ConfigEntry Enabled { get; private set; } public abstract string Id { get; } public abstract string DisplayName { get; } public abstract string Description { get; } public virtual bool BlocksLeaderboard => false; public virtual void BindConfig(ConfigFile cfg) { Enabled = cfg.Bind(Id, "Enabled", false, Description); } public abstract void ApplyPatches(Harmony harmony); } [BepInPlugin("com.rizzotto.megamod", "Rizzotto Megamod", "0.5.1")] public class Plugin : BasePlugin { public const string GUID = "com.rizzotto.megamod"; public const string VERSION = "0.5.1"; internal static ManualLogSource Log; internal static ConfigFile Cfg; internal static ModFeature[] Features; public static bool IsEnabled() where T : ModFeature { if (Features == null) { return false; } for (int i = 0; i < Features.Length; i++) { if (Features[i] is T val) { if (val.Enabled != null) { return val.Enabled.Value; } return false; } } return false; } public override void Load() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) Log = ((BasePlugin)this).Log; Cfg = ((BasePlugin)this).Config; Diagnostics.Begin("0.5.1"); Harmony harmony = new Harmony("com.rizzotto.megamod"); Diagnostics.TryApplyLeaderboardBlocker(harmony); RewiredInputBlocker.Init(harmony); Features = new ModFeature[14] { new LevelUncapFeature(), new AllWeaponsFeature(), new BurgerStatFeature(), new BaldForestFeature(), new TomeUncapFeature(), new MultiPassiveFeature(), new EliteSlayerFeature(), new EscalatingDifficultyFeature(), new ItemHotkeysFeature(), new ItemUpgraderFeature(), new OneShotFeature(), new PotLuckFeature(), new PumpkinStackerFeature(), new UnlimitedBanishFeature() }; ModFeature[] features = Features; foreach (ModFeature modFeature in features) { try { modFeature.BindConfig(Cfg); } catch (Exception ex) { Diagnostics.Error("BindConfig failed for " + modFeature.Id, ex); } } Diagnostics.Line(""); Diagnostics.Line("Feature load (patches always register; each checks its own Enabled at runtime):"); int num = 0; features = Features; for (int i = 0; i < features.Length; i++) { if (Diagnostics.TryApply(features[i], harmony)) { num++; } } Diagnostics.Finish(num, Features.Length); bool flag = default(bool); try { MegaMenu.BindConfig(Cfg); ClassInjector.RegisterTypeInIl2Cpp(); GameObject val = new GameObject("Megamod_MegaMenu") { hideFlags = (HideFlags)61 }; val.AddComponent(); Object.DontDestroyOnLoad((Object)val); ManualLogSource log = Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(42, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Press ["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(MegaMenu.ToggleKey.Value); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] in-game to open the megamod menu."); } log.LogInfo(val2); } catch (Exception ex2) { ManualLogSource log2 = Log; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(26, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to spawn MegaMenu: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex2); } log2.LogError(val3); } Log.LogInfo((object)"Leaderboard submission is permanently disabled while this mod is installed."); } } public static class RewiredInputBlocker { public static void Init(Harmony harmony) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown try { Type type = AccessTools.TypeByName("Rewired.Player"); if (type == null) { Plugin.Log.LogWarning((object)"[RewiredBlocker] Rewired.Player not found; keyboard leak fix disabled"); return; } int num = 0; num += PatchAll(harmony, type, "GetButton", typeof(bool)); num += PatchAll(harmony, type, "GetButtonDown", typeof(bool)); num += PatchAll(harmony, type, "GetButtonUp", typeof(bool)); num += PatchAll(harmony, type, "GetAxis", typeof(float)); num += PatchAll(harmony, type, "GetAxisRaw", typeof(float)); num += PatchAll(harmony, type, "GetNegativeButton", typeof(bool)); num += PatchAll(harmony, type, "GetNegativeButtonDown", typeof(bool)); num += PatchAll(harmony, type, "GetNegativeButtonUp", typeof(bool)); ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(56, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RewiredBlocker] patched "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Rewired.Player input method(s)"); } log.LogInfo(val); } catch (Exception ex) { Plugin.Log.LogError((object)("[RewiredBlocker] init failed: " + ex)); } } private static int PatchAll(Harmony harmony, Type type, string methodName, Type returnType) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown int num = 0; try { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name != methodName || methodInfo.ReturnType != returnType || methodInfo.IsGenericMethodDefinition) { continue; } MethodInfo methodInfo2; if (returnType == typeof(bool)) { methodInfo2 = AccessTools.Method(typeof(RewiredInputBlocker), "BoolPrefix", (Type[])null, (Type[])null); } else { if (!(returnType == typeof(float))) { continue; } methodInfo2 = AccessTools.Method(typeof(RewiredInputBlocker), "FloatPrefix", (Type[])null, (Type[])null); } try { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); num++; } catch (Exception ex) { Plugin.Log.LogWarning((object)("[RewiredBlocker] failed " + type.Name + "." + methodName + ": " + ex.Message)); } } } catch (Exception ex2) { Plugin.Log.LogWarning((object)("[RewiredBlocker] reflect " + methodName + ": " + ex2.Message)); } return num; } private static bool BoolPrefix(ref bool __result) { if (!MegaMenu.IsOpen) { return true; } __result = false; return false; } private static bool FloatPrefix(ref float __result) { if (!MegaMenu.IsOpen) { return true; } __result = 0f; return false; } } } namespace RizzottoMegamod.Features { public sealed class AllWeaponsFeature : ModFeature { private static class Patches { private static IntPtr _expandedForPicker; [HarmonyPatch(typeof(InventoryUtility), "GetNumMaxWeaponSlots")] [HarmonyPostfix] private static void GetNumMaxWeaponSlots_Postfix(ref int __result) { if (Plugin.IsEnabled()) { GameManager instance = GameManager.Instance; if ((Object)(object)((instance != null) ? instance.player : null) != (Object)null) { __result = 31; } } } [HarmonyPatch(typeof(InventoryUtility), "GetNumAvailableWeaponSlots")] [HarmonyPostfix] private static void GetNumAvailableWeaponSlots_Postfix(ref int __result) { if (Plugin.IsEnabled()) { GameManager instance = GameManager.Instance; if ((Object)(object)((instance != null) ? instance.player : null) != (Object)null) { __result = 31; } } } [HarmonyPatch(typeof(InventoryHud), "Refresh")] [HarmonyPrefix] private static void InventoryHudRefresh_Prefix(InventoryHud __instance) { if (!Plugin.IsEnabled()) { return; } GameManager instance = GameManager.Instance; if ((Object)(object)((instance != null) ? instance.player : null) == (Object)null) { return; } int numAvailableWeaponSlots = InventoryUtility.GetNumAvailableWeaponSlots(); int count = __instance.weaponContainers.Count; if (count >= numAvailableWeaponSlots) { return; } for (int i = count; i < numAvailableWeaponSlots; i++) { InventoryItemPrefabUI component = Object.Instantiate(__instance.itemContainerPrefab, __instance.weaponParent).GetComponent(); if ((Object)(object)component != (Object)null) { __instance.weaponContainers.Add(component); } } } [HarmonyPatch(typeof(UpgradeInventoryUI), "Refresh")] [HarmonyPrefix] private static void UpgradeInventoryUIRefresh_Prefix(UpgradeInventoryUI __instance) { if (!Plugin.IsEnabled()) { return; } GameManager instance = GameManager.Instance; if ((Object)(object)((instance != null) ? instance.player : null) == (Object)null) { return; } int numAvailableWeaponSlots = InventoryUtility.GetNumAvailableWeaponSlots(); int count = __instance.weaponContainers.Count; if (count >= numAvailableWeaponSlots) { return; } for (int i = count; i < numAvailableWeaponSlots; i++) { InventoryItemPrefabUI component = Object.Instantiate(__instance.itemContainerPrefab, __instance.weaponParent).GetComponent(); if ((Object)(object)component != (Object)null) { __instance.weaponContainers.Add(component); } } } [HarmonyPatch(typeof(UpgradePicker), "ShuffleUpgrades")] [HarmonyPrefix] private static void ShuffleUpgrades_Prefix(UpgradePicker __instance, EEncounter encounterType) { //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsEnabled() || (int)encounterType != 0 || ((Il2CppObjectBase)__instance).Pointer == _expandedForPicker || __instance.buttons == null || ((Il2CppArrayBase)(object)__instance.buttons).Length < 3) { return; } try { GameObject gameObject = ((Component)((Il2CppArrayBase)(object)__instance.buttons)[0]).gameObject; Transform parent = gameObject.transform.parent; if (((Il2CppArrayBase)(object)__instance.buttons).Length < 4) { GameObject obj = Object.Instantiate(gameObject, parent); ((Object)obj).name = "UpgradeButton_Modded"; UpgradeButton component = obj.GetComponent(); if ((Object)(object)component == (Object)null) { return; } component.upgradePicker = __instance; Il2CppReferenceArray val = new Il2CppReferenceArray((long)(((Il2CppArrayBase)(object)__instance.buttons).Length + 1)); for (int i = 0; i < ((Il2CppArrayBase)(object)__instance.buttons).Length; i++) { ((Il2CppArrayBase)(object)val)[i] = ((Il2CppArrayBase)(object)__instance.buttons)[i]; } ((Il2CppArrayBase)(object)val)[((Il2CppArrayBase)(object)__instance.buttons).Length] = component; __instance.buttons = val; } RectTransform component2 = gameObject.GetComponent(); float num; if (!((Object)(object)component2 != (Object)null)) { num = 150f; } else { Rect rect = component2.rect; num = ((Rect)(ref rect)).height; } float num2 = num + 10f; Transform val2 = parent; while ((Object)(object)val2 != (Object)null) { string name = ((Object)val2).name; if (name == "Content" || name == "W_Offers") { RectTransform component3 = ((Component)val2).GetComponent(); if ((Object)(object)component3 != (Object)null) { Vector2 sizeDelta = component3.sizeDelta; component3.sizeDelta = new Vector2(sizeDelta.x, sizeDelta.y + num2); } } val2 = val2.parent; } _expandedForPicker = ((Il2CppObjectBase)__instance).Pointer; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(35, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[AllWeapons] expand picker failed: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex.Message); } log.LogError(val3); } } [HarmonyPatch(typeof(InventoryUtility), "GetRandomUpgrades")] [HarmonyPostfix] private static void GetRandomUpgrades_Postfix(List __result) { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Invalid comparison between Unknown and I4 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Invalid comparison between Unknown and I4 //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Invalid comparison between Unknown and I4 //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsEnabled() || __result == null || __result.Count == 0) { return; } GameManager instance = GameManager.Instance; MyPlayer val = ((instance != null) ? instance.player : null); if ((Object)(object)val == (Object)null) { return; } AlwaysManager instance2 = AlwaysManager.Instance; DataManager val2 = ((instance2 != null) ? instance2.dataManager : null); if ((Object)(object)val2 == (Object)null) { return; } WeaponInventory weaponInventory = val.inventory.weaponInventory; TomeInventory tomeInventory = val.inventory.tomeInventory; int num = 0; int num2 = 0; for (int i = 0; i < __result.Count; i++) { IUpgradable obj = __result[i]; if ((Object)(object)((obj != null) ? ((Il2CppObjectBase)obj).TryCast() : null) != (Object)null) { num++; continue; } IUpgradable obj2 = __result[i]; if ((Object)(object)((obj2 != null) ? ((Il2CppObjectBase)obj2).TryCast() : null) != (Object)null) { num2++; } } HashSet banishedUpgradables = RunUnlockables.banishedUpgradables; List list = new List(); List allWeapons = val2.GetAllWeapons(); bool flag = weaponInventory.GetNumWeapons() < InventoryUtility.GetNumAvailableWeaponSlots(); for (int j = 0; j < allWeapons.Count; j++) { WeaponData val3 = allWeapons[j]; if ((int)val3.eWeapon == 8 || (int)val3.eWeapon == 17 || ((int)val3.eWeapon != 20 && !((Il2CppObjectBase)val3).Cast().isEnabled) || !(weaponInventory.weapons.ContainsKey(val3.eWeapon) || flag)) { continue; } bool flag2 = false; for (int k = 0; k < __result.Count; k++) { IUpgradable obj3 = __result[k]; WeaponData val4 = ((obj3 != null) ? ((Il2CppObjectBase)obj3).TryCast() : null); if ((Object)(object)val4 != (Object)null && val4.eWeapon == val3.eWeapon) { flag2 = true; break; } } if (!flag2) { list.Add(val3); } } List list2 = new List(); List allTomes = val2.GetAllTomes(); bool flag3 = InventoryUtility.GetNumAvailableTomeSlots() > tomeInventory.tomeLevels.Count; for (int l = 0; l < allTomes.Count; l++) { TomeData val5 = allTomes[l]; if ((banishedUpgradables != null && banishedUpgradables.Contains(((Il2CppObjectBase)val5).Cast())) || !((Il2CppObjectBase)val5).Cast().isEnabled) { continue; } if (tomeInventory.HasTome(val5.eTome)) { int tomeLevel = tomeInventory.GetTomeLevel(val5.eTome); int maxLevel = val5.GetMaxLevel(); if (tomeLevel >= maxLevel) { continue; } } else if (!flag3) { continue; } bool flag4 = false; for (int m = 0; m < __result.Count; m++) { IUpgradable obj4 = __result[m]; TomeData val6 = ((obj4 != null) ? ((Il2CppObjectBase)obj4).TryCast() : null); if ((Object)(object)val6 != (Object)null && val6.eTome == val5.eTome) { flag4 = true; break; } } if (!flag4) { list2.Add(val5); } } while (__result.Count < 4) { if (num2 < 2 && list2.Count > 0) { int index = Random.Range(0, list2.Count); __result.Add(((Il2CppObjectBase)list2[index]).Cast()); list2.RemoveAt(index); num2++; continue; } if (num < 2 && list.Count > 0) { int index2 = Random.Range(0, list.Count); __result.Add(((Il2CppObjectBase)list[index2]).Cast()); list.RemoveAt(index2); num++; continue; } if (list2.Count > 0) { int index3 = Random.Range(0, list2.Count); __result.Add(((Il2CppObjectBase)list2[index3]).Cast()); list2.RemoveAt(index3); num2++; continue; } if (list.Count <= 0) { break; } int index4 = Random.Range(0, list.Count); __result.Add(((Il2CppObjectBase)list[index4]).Cast()); list.RemoveAt(index4); num++; } num = 0; num2 = 0; for (int n = 0; n < __result.Count; n++) { IUpgradable obj5 = __result[n]; if ((Object)(object)((obj5 != null) ? ((Il2CppObjectBase)obj5).TryCast() : null) != (Object)null) { num++; continue; } IUpgradable obj6 = __result[n]; if ((Object)(object)((obj6 != null) ? ((Il2CppObjectBase)obj6).TryCast() : null) != (Object)null) { num2++; } } while (num > 2 && num2 < 2 && list2.Count > 0) { for (int num3 = __result.Count - 1; num3 >= 0; num3--) { IUpgradable obj7 = __result[num3]; if ((Object)(object)((obj7 != null) ? ((Il2CppObjectBase)obj7).TryCast() : null) != (Object)null) { int index5 = Random.Range(0, list2.Count); __result[num3] = ((Il2CppObjectBase)list2[index5]).Cast(); list2.RemoveAt(index5); num--; num2++; break; } } } while (num2 > 2 && num < 2 && list.Count > 0) { for (int num4 = __result.Count - 1; num4 >= 0; num4--) { IUpgradable obj8 = __result[num4]; if ((Object)(object)((obj8 != null) ? ((Il2CppObjectBase)obj8).TryCast() : null) != (Object)null) { int index6 = Random.Range(0, list.Count); __result[num4] = ((Il2CppObjectBase)list[index6]).Cast(); list.RemoveAt(index6); num2--; num++; break; } } } } } public override string Id => "AllWeapons"; public override string DisplayName => "All Weapons"; public override string Description => "Expands the inventory HUD to fit all 31 weapons, gives 4 upgrade choices (2 weapons + 2 tomes), and unlocks all weapon slots from the start."; public override bool BlocksLeaderboard => true; public override void ApplyPatches(Harmony harmony) { harmony.PatchAll(typeof(Patches)); } } public sealed class BaldForestFeature : ModFeature { private static class Patches { private static GameObject _balancePrefab = null; private static readonly HashSet OurShrines = new HashSet(); private static InteractableShrineBalance _lastInteracted = null; private static int _interactCount; private static MyPlayer _lastPlayer = null; private static readonly Dictionary ForcedStats = new Dictionary { { 1, (EStat)0 }, { 4, (EStat)32 } }; [HarmonyPatch(typeof(SpawnInteractables), "SpawnShrines")] [HarmonyPrefix] private static void SpawnShrines_Prefix() { if (!Plugin.IsEnabled()) { return; } OurShrines.Clear(); if ((Object)(object)_balancePrefab != (Object)null) { return; } AlwaysManager instance = AlwaysManager.Instance; DataManager val = ((instance != null) ? instance.dataManager : null); if (((val != null) ? val.maps : null) == null) { return; } for (int i = 0; i < val.maps.Count; i++) { MapData val2 = val.maps[i]; if (((val2 != null) ? val2.shrines : null) == null) { continue; } for (int j = 0; j < ((Il2CppArrayBase)(object)val2.shrines).Length; j++) { GameObject val3 = ((Il2CppArrayBase)(object)val2.shrines)[j]; if ((Object)(object)val3 != (Object)null && (Object)(object)val3.GetComponent(Il2CppType.From(typeof(InteractableShrineBalance))) != (Object)null) { _balancePrefab = val3; return; } } } } [HarmonyPatch(typeof(SpawnInteractables), "SpawnShrines")] [HarmonyPostfix] private static void SpawnShrines_Postfix() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsEnabled()) { return; } MapData currentMap = MapController.currentMap; if ((Object)(object)currentMap == (Object)null || (int)currentMap.eMap != 1 || (Object)(object)_balancePrefab == (Object)null) { return; } Il2CppArrayBase val = Object.FindObjectsOfType(); List list = new List(); Transform val2 = null; for (int i = 0; i < val.Length; i++) { BaseInteractable val3 = val[i]; string text = ((Object)val3).name ?? ""; bool flag = text.Contains("Shady") || text.Contains("shady"); if (text.Contains("Shrine") || text.Contains("shrine") || text.Contains("Moai") || text.Contains("moai") || text.Contains("Charge") || text.Contains("charge")) { list.Add(((Component)val3).transform.position); if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val3).transform.parent; } } else if (flag) { list.Add(((Component)val3).transform.position); } } if (list.Count == 0) { return; } int num = Mathf.Clamp((_instance?.ExtraShrines?.Value).GetValueOrDefault(5), 0, 20); if (num == 0) { return; } int count = list.Count; int num2 = ((count <= num) ? 1 : (count / num)); RaycastHit val7 = default(RaycastHit); for (int j = 0; j < num; j++) { int index = j * num2 % count; Vector3 val4 = list[index]; float num3 = Random.Range(0f, 360f) * ((float)Math.PI / 180f); float num4 = Random.Range(15f, 30f); Vector3 val5 = val4 + new Vector3(Mathf.Cos(num3) * num4, 0f, Mathf.Sin(num3) * num4); Vector3 val6 = val5; if (Physics.Raycast(new Vector3(val5.x, val5.y + 50f, val5.z), Vector3.down, ref val7, 100f)) { val6 = ((RaycastHit)(ref val7)).point; } GameObject val8 = Object.Instantiate(_balancePrefab, val6, _balancePrefab.transform.rotation); if ((Object)(object)val2 != (Object)null) { val8.transform.SetParent(val2); } InteractableShrineBalance component = val8.GetComponent(); if ((Object)(object)component != (Object)null) { OurShrines.Add(((Il2CppObjectBase)component).Pointer); } } } [HarmonyPatch(typeof(InteractableShrineBalance), "Interact")] [HarmonyPrefix] private static void Interact_Prefix(InteractableShrineBalance __instance) { if (!Plugin.IsEnabled()) { return; } _lastInteracted = __instance; if (!OurShrines.Contains(((Il2CppObjectBase)__instance).Pointer)) { return; } GameManager instance = GameManager.Instance; MyPlayer val = ((instance != null) ? instance.player : null); if ((Object)(object)val != (Object)(object)_lastPlayer) { _lastPlayer = val; if (MapController.GetStageIndex() == 0) { _interactCount = 0; } } _interactCount++; } [HarmonyPatch(typeof(EncounterUtility), "GetBalanceShrineOffers")] [HarmonyPostfix] private static void GetBalanceOffers_Postfix(List __result) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00b4: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsEnabled() || __result == null || __result.Count == 0) { return; } InteractableShrineBalance lastInteracted = _lastInteracted; if ((Object)(object)lastInteracted == (Object)null || !OurShrines.Contains(((Il2CppObjectBase)lastInteracted).Pointer) || !ForcedStats.TryGetValue(_interactCount, out var value)) { return; } EncounterOffer val = __result[0]; if (((val != null) ? val.effects : null) == null) { return; } EStat stat = value; for (int i = 0; i < ((Il2CppArrayBase)(object)val.effects).Length; i++) { EffectStat val2 = ((Il2CppArrayBase)(object)val.effects)[i]; if (((val2 != null) ? val2.statModifier : null) != null && val2.statModifier.modification > 1f) { stat = val2.statModifier.stat; StatModifier val3 = new StatModifier(); val3.stat = value; val3.modifyType = val2.statModifier.modifyType; val3.modification = val2.statModifier.modification; val2.statModifier = val3; break; } } for (int j = 0; j < ((Il2CppArrayBase)(object)val.effects).Length; j++) { EffectStat val4 = ((Il2CppArrayBase)(object)val.effects)[j]; if (((val4 != null) ? val4.statModifier : null) != null && val4.statModifier.modification <= 1f && val4.statModifier.stat == value) { StatModifier val5 = new StatModifier(); val5.stat = stat; val5.modifyType = val4.statModifier.modifyType; val5.modification = val4.statModifier.modification; val4.statModifier = val5; break; } } } } public ConfigEntry ExtraShrines; private static BaldForestFeature _instance; public override string Id => "BaldForest"; public override string DisplayName => "Bald Forest"; public override string Description => "Spawns extra Balance shrines (\"bald heads\") on Forest stages. Bald head #1 forces +Max HP, #4 forces +XP Gain; the rest are random."; public override bool BlocksLeaderboard => true; public BaldForestFeature() { _instance = this; } public override void BindConfig(ConfigFile cfg) { base.BindConfig(cfg); ExtraShrines = cfg.Bind(Id, "ExtraShrines", 5, "How many extra Balance shrines to spawn on each Forest stage. Range 0 - 20."); } public override void ApplyPatches(Harmony harmony) { harmony.PatchAll(typeof(Patches)); } } public sealed class BurgerStatFeature : ModFeature { public struct StatDef { public EStat Stat; public EStatModifyType ModType; public float Amount; public StatDef(EStat s, EStatModifyType m, float a) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) Stat = s; ModType = m; Amount = a; } } private static class Patches { [HarmonyPatch(typeof(ItemBorgor), "OnInitOrAmountChanged")] [HarmonyPrefix] private static void Borgor_Init_Prefix(ItemBorgor __instance) { if (Plugin.IsEnabled()) { float chancePerAmount = (__instance.baseChance = _instance.ChancePerStack?.Value ?? 0.05f); __instance.chancePerAmount = chancePerAmount; } } [HarmonyPatch(typeof(ItemBorgor), "GetDescription")] [HarmonyPostfix] private static void Borgor_Desc_Postfix(ref string __result) { if (Plugin.IsEnabled() && !string.IsNullOrEmpty(__result)) { int num = (int)Math.Round((_instance.ChancePerStack?.Value ?? 0.05f) * 100f); __result = __result.Replace("2%", num + "%"); } } [HarmonyPatch(typeof(Borgar), "OnCollisionEnter")] [HarmonyPostfix] private static void Borgar_OnCollision_Postfix(Borgar __instance, Collision collision) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown if (!Plugin.IsEnabled()) { return; } try { if (collision == null || (Object)(object)collision.gameObject == (Object)null || (Object)(object)collision.gameObject.GetComponentInParent() == (Object)null) { return; } int key = Rng.Next(AllowedStats.Length); lock (PendingPickups) { if (PendingPickups.ContainsKey(key)) { PendingPickups[key]++; } else { PendingPickups[key] = 1; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(27, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BurgerStat] pickup error: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex.Message); } log.LogError(val); } } } public class BurgerStatBehaviour : MonoBehaviour { private float _timer; public BurgerStatBehaviour(IntPtr ptr) : base(ptr) { } private void Update() { if (Plugin.IsEnabled()) { _timer += Time.deltaTime; if (!(_timer < 2f)) { _timer = 0f; ProcessPending(); } } } private void ProcessPending() { //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary; lock (PendingPickups) { if (PendingPickups.Count == 0) { return; } dictionary = new Dictionary(PendingPickups); PendingPickups.Clear(); } GameManager instance = GameManager.Instance; object obj; if (instance == null) { obj = null; } else { MyPlayer player = instance.player; if (player == null) { obj = null; } else { PlayerInventory inventory = player.inventory; obj = ((inventory != null) ? inventory.statInventory : null); } } StatInventory val = (StatInventory)obj; if (val == null) { return; } foreach (KeyValuePair item in dictionary) { StatDef statDef = AllowedStats[item.Key]; int value = item.Value; float num = statDef.Amount * (float)value; StatModifier val2 = new StatModifier(); val2.stat = statDef.Stat; val2.modifyType = statDef.ModType; val2.modification = num; val.ChangeStat(val2, true, 0f, false); try { UiManager uiManager = instance.uiManager; ScoreUi val3 = ((uiManager != null) ? uiManager.scoreUi : null); if ((Object)(object)val3 != (Object)null && val3.GetQueueCount() < 3) { string? text; if (StatDisplay.TryGetValue(statDef.Stat, out (string, bool) value2)) { (text, _) = value2; } else { text = ((object)(EStat)(ref statDef.Stat)).ToString(); } string value3 = text; string value4 = FormatValue(statDef.Stat, num); string text2 = $"Burger {value3} +{value4}"; val3.AddScore(text2, "", true, true, 1f); } } catch { } ManualLogSource log = Plugin.Log; bool flag; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(17, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[BurgerStat] "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(value); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("x "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(statDef.Stat); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" +"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(num); } log.LogInfo(val4); } } } public ConfigEntry ChancePerStack; private static BurgerStatFeature _instance = null; public static readonly StatDef[] AllowedStats = new StatDef[25] { new StatDef((EStat)12, (EStatModifyType)0, 0.05f), new StatDef((EStat)15, (EStatModifyType)0, 0.04f), new StatDef((EStat)18, (EStatModifyType)2, 0.03f), new StatDef((EStat)19, (EStatModifyType)2, 0.05f), new StatDef((EStat)11, (EStatModifyType)0, 0.07f), new StatDef((EStat)16, (EStatModifyType)2, 0.15f), new StatDef((EStat)9, (EStatModifyType)0, 0.02f), new StatDef((EStat)24, (EStatModifyType)0, 0.04f), new StatDef((EStat)10, (EStatModifyType)0, 0.04f), new StatDef((EStat)3, (EStatModifyType)2, 5f), new StatDef((EStat)0, (EStatModifyType)2, 12f), new StatDef((EStat)1, (EStatModifyType)2, 15f), new StatDef((EStat)4, (EStatModifyType)2, 0.01f), new StatDef((EStat)2, (EStatModifyType)2, 3f), new StatDef((EStat)5, (EStatModifyType)2, 0.01f), new StatDef((EStat)17, (EStatModifyType)2, 0.015f), new StatDef((EStat)25, (EStatModifyType)0, 0.06f), new StatDef((EStat)29, (EStatModifyType)0, 0.08f), new StatDef((EStat)30, (EStatModifyType)2, 0.03f), new StatDef((EStat)31, (EStatModifyType)0, 0.04f), new StatDef((EStat)32, (EStatModifyType)0, 0.04f), new StatDef((EStat)38, (EStatModifyType)2, 0.04f), new StatDef((EStat)41, (EStatModifyType)2, 0.04f), new StatDef((EStat)40, (EStatModifyType)0, 0.04f), new StatDef((EStat)46, (EStatModifyType)2, 0.08f) }; public static readonly Dictionary PendingPickups = new Dictionary(); private static readonly Random Rng = new Random(); public static readonly Dictionary StatDisplay = new Dictionary { { (EStat)12, ("Damage", true) }, { (EStat)15, ("Attack Speed", true) }, { (EStat)18, ("Crit Chance", true) }, { (EStat)19, ("Crit Damage", true) }, { (EStat)11, ("Projectile Speed", true) }, { (EStat)16, ("Projectile Count", false) }, { (EStat)9, ("Size", true) }, { (EStat)24, ("Knockback", true) }, { (EStat)10, ("Duration", true) }, { (EStat)3, ("Thorns", false) }, { (EStat)0, ("Max HP", false) }, { (EStat)1, ("HP Regen", false) }, { (EStat)4, ("Armor", true) }, { (EStat)2, ("Shield", false) }, { (EStat)5, ("Evasion", true) }, { (EStat)17, ("Lifesteal", true) }, { (EStat)25, ("Move Speed", true) }, { (EStat)29, ("Pickup Range", true) }, { (EStat)30, ("Luck", true) }, { (EStat)31, ("Gold Gain", true) }, { (EStat)32, ("XP Gain", true) }, { (EStat)38, ("Difficulty", true) }, { (EStat)41, ("Powerup Chance", true) }, { (EStat)40, ("Powerup Multiplier", true) }, { (EStat)46, ("Extra Jumps", false) } }; public override string Id => "BurgerStat"; public override string DisplayName => "Burger Stat"; public override string Description => "Borgar pickups have a chance to grant a random stat boost in addition to healing."; public override bool BlocksLeaderboard => true; public BurgerStatFeature() { _instance = this; } public override void BindConfig(ConfigFile cfg) { base.BindConfig(cfg); ChancePerStack = cfg.Bind(Id, "ChancePerStack", 0.05f, "Per-stack stat-grant chance for Borgar (0.0–1.0). Vanilla = 0.02 base + 0.01 per extra stack; this mod uses the same value for both base and per-stack so the chance scales linearly."); } public override void ApplyPatches(Harmony harmony) { //IL_001a: 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) //IL_002b: Expected O, but got Unknown harmony.PatchAll(typeof(Patches)); ClassInjector.RegisterTypeInIl2Cpp(); GameObject val = new GameObject("Megamod_BurgerStat"); val.AddComponent(); Object.DontDestroyOnLoad((Object)val); } private static string FormatValue(EStat s, float value) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (StatDisplay.TryGetValue(s, out (string, bool) value2) && value2.Item2) { float num = value * 100f; if (num % 1f == 0f) { return $"{num:F0}%"; } return $"{num:F1}%"; } if (value % 1f == 0f) { return $"{value:F0}"; } return $"{value:G4}"; } } public sealed class EliteSlayerFeature : ModFeature { public struct StatDef { public EStat Stat; public EStatModifyType ModType; public float Amount; public StatDef(EStat s, EStatModifyType m, float a) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) Stat = s; ModType = m; Amount = a; } } private static class Patches { [HarmonyPatch(typeof(Enemy), "EnemyDied", new Type[] { typeof(DamageContainer) })] [HarmonyPostfix] private static void EnemyDied_Postfix(Enemy __instance) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown if (!Plugin.IsEnabled()) { return; } try { if (!__instance.IsElite()) { return; } int key = Rng.Next(AllowedStats.Length); lock (PendingKills) { if (PendingKills.ContainsKey(key)) { PendingKills[key]++; } else { PendingKills[key] = 1; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[EliteSlayer] EnemyDied: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex.Message); } log.LogError(val); } } } public class EliteSlayerBehaviour : MonoBehaviour { private bool _subscribed; private float _timer; private GUIStyle _boxStyle; private GUIStyle _titleStyle; private GUIStyle _labelStyle; public EliteSlayerBehaviour(IntPtr ptr) : base(ptr) { } private void Update() { if (Plugin.IsEnabled() && !((Object)(object)GameManager.Instance == (Object)null)) { if (!_subscribed) { GameManager.A_StageStarted += Action.op_Implicit((Action)OnStageStarted); _subscribed = true; } _timer += Time.deltaTime; if (!(_timer < 2f)) { _timer = 0f; ProcessPending(); } } } private static void OnStageStarted() { StageGains.Clear(); StageCounts.Clear(); } private void ProcessPending() { //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary; lock (PendingKills) { if (PendingKills.Count == 0) { return; } dictionary = new Dictionary(PendingKills); PendingKills.Clear(); } GameManager instance = GameManager.Instance; object obj; if (instance == null) { obj = null; } else { MyPlayer player = instance.player; if (player == null) { obj = null; } else { PlayerInventory inventory = player.inventory; obj = ((inventory != null) ? inventory.statInventory : null); } } StatInventory val = (StatInventory)obj; if (val == null) { return; } float num = Mathf.Clamp((_instance?.BoostMultiplier?.Value).GetValueOrDefault(1f), 0.1f, 2f); foreach (KeyValuePair item in dictionary) { StatDef statDef = AllowedStats[item.Key]; int value = item.Value; float num2 = statDef.Amount * (float)value * num; StatModifier val2 = new StatModifier(); val2.stat = statDef.Stat; val2.modifyType = statDef.ModType; val2.modification = num2; val.ChangeStat(val2, true, 0f, false); if (StageGains.ContainsKey(statDef.Stat)) { StageGains[statDef.Stat] += num2; } else { StageGains[statDef.Stat] = num2; } if (StageCounts.ContainsKey(statDef.Stat)) { StageCounts[statDef.Stat] += value; } else { StageCounts[statDef.Stat] = value; } try { UiManager uiManager = instance.uiManager; ScoreUi val3 = ((uiManager != null) ? uiManager.scoreUi : null); if ((Object)(object)val3 != (Object)null && val3.GetQueueCount() < 3) { string value2 = DisplayName_(statDef.Stat); string value3 = FormatValue(statDef.Stat, num2); string text = $"Elite {value2} +{value3}"; val3.AddScore(text, "", true, true, 1f); } } catch { } ManualLogSource log = Plugin.Log; bool flag; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(18, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[EliteSlayer] "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(value); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("x "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(statDef.Stat); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" +"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(num2); } log.LogInfo(val4); } } private void OnGUI() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsEnabled() || MegaMenu.IsOpen) { return; } bool flag = Input.GetKey((KeyCode)9); if (!flag) { try { GameManager instance = GameManager.Instance; object obj; if (instance == null) { obj = null; } else { UiManager uiManager = instance.uiManager; obj = ((uiManager != null) ? uiManager.pause : null); } PauseUi val = (PauseUi)obj; if ((Object)(object)val != (Object)null && val.IsPaused()) { flag = true; } } catch { } } if (!flag) { return; } EnsureStyles(); int count = StageGains.Count; float num = 38f; num += ((count == 0) ? 22f : ((float)count * 22f)); num += 10f; float num2 = (float)Screen.width * 0.625f; float num3 = 80f; GUI.Box(new Rect(num2, num3, 280f, num), GUIContent.none, _boxStyle); float num4 = num2 + 10f; float num5 = num3 + 10f; GUI.Label(new Rect(num4, num5, 260f, 28f), "Elite Kills — Stage Bonuses", _titleStyle); num5 += 28f; if (count == 0) { GUI.Label(new Rect(num4, num5, 260f, 22f), "No elite kills yet", _labelStyle); return; } List list = new List(StageGains.Keys); list.Sort(delegate(EStat a, EStat b) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) int value5; int value6 = (StageCounts.TryGetValue(a, out value5) ? value5 : 0); int value7; return (StageCounts.TryGetValue(b, out value7) ? value7 : 0).CompareTo(value6); }); for (int i = 0; i < list.Count; i++) { EStat val2 = list[i]; string value = DisplayName_(val2); string value2 = FormatValue(val2, StageGains[val2]); int value3; int value4 = (StageCounts.TryGetValue(val2, out value3) ? value3 : 0); string text = $"{value4}x {value}: +{value2}"; GUI.Label(new Rect(num4, num5, 260f, 22f), text, _labelStyle); num5 += 22f; } } private void EnsureStyles() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown if (_boxStyle == null || _boxStyle.normal == null || !((Object)(object)_boxStyle.normal.background != (Object)null)) { Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.85f)); val.Apply(); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); GUIStyle val2 = new GUIStyle(GUI.skin.box); val2.normal.background = val; _boxStyle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val3.normal.textColor = new Color(1f, 0.85f, 0.2f); _titleStyle = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 14, richText = true }; val4.normal.textColor = Color.white; _labelStyle = val4; } } } public ConfigEntry BoostMultiplier; private static EliteSlayerFeature _instance = null; public static readonly StatDef[] AllowedStats = new StatDef[25] { new StatDef((EStat)12, (EStatModifyType)0, 0.03f), new StatDef((EStat)15, (EStatModifyType)0, 0.02f), new StatDef((EStat)18, (EStatModifyType)2, 0.02f), new StatDef((EStat)19, (EStatModifyType)2, 0.02f), new StatDef((EStat)11, (EStatModifyType)0, 0.05f), new StatDef((EStat)16, (EStatModifyType)2, 0.1f), new StatDef((EStat)9, (EStatModifyType)0, 0.01f), new StatDef((EStat)24, (EStatModifyType)0, 0.02f), new StatDef((EStat)10, (EStatModifyType)0, 0.02f), new StatDef((EStat)3, (EStatModifyType)2, 3f), new StatDef((EStat)0, (EStatModifyType)2, 8f), new StatDef((EStat)1, (EStatModifyType)2, 10f), new StatDef((EStat)4, (EStatModifyType)2, 0.005f), new StatDef((EStat)2, (EStatModifyType)2, 2f), new StatDef((EStat)5, (EStatModifyType)2, 0.005f), new StatDef((EStat)17, (EStatModifyType)2, 0.01f), new StatDef((EStat)25, (EStatModifyType)0, 0.05f), new StatDef((EStat)29, (EStatModifyType)0, 0.06f), new StatDef((EStat)30, (EStatModifyType)2, 0.02f), new StatDef((EStat)31, (EStatModifyType)0, 0.02f), new StatDef((EStat)32, (EStatModifyType)0, 0.02f), new StatDef((EStat)38, (EStatModifyType)2, 0.03f), new StatDef((EStat)41, (EStatModifyType)2, 0.03f), new StatDef((EStat)40, (EStatModifyType)0, 0.02f), new StatDef((EStat)46, (EStatModifyType)2, 0.05f) }; public static readonly Dictionary PendingKills = new Dictionary(); private static readonly Random Rng = new Random(); public static readonly Dictionary StageGains = new Dictionary(); public static readonly Dictionary StageCounts = new Dictionary(); public static readonly Dictionary StatDisplay = new Dictionary { { (EStat)12, ("Damage", true) }, { (EStat)15, ("Attack Speed", true) }, { (EStat)18, ("Crit Chance", true) }, { (EStat)19, ("Crit Damage", true) }, { (EStat)11, ("Projectile Speed", true) }, { (EStat)16, ("Projectile Count", false) }, { (EStat)9, ("Size", true) }, { (EStat)24, ("Knockback", true) }, { (EStat)10, ("Duration", true) }, { (EStat)3, ("Thorns", false) }, { (EStat)0, ("Max HP", false) }, { (EStat)1, ("HP Regen", false) }, { (EStat)4, ("Armor", true) }, { (EStat)2, ("Shield", false) }, { (EStat)5, ("Evasion", true) }, { (EStat)17, ("Lifesteal", true) }, { (EStat)25, ("Move Speed", true) }, { (EStat)29, ("Pickup Range", true) }, { (EStat)30, ("Luck", true) }, { (EStat)31, ("Gold Gain", true) }, { (EStat)32, ("XP Gain", true) }, { (EStat)38, ("Difficulty", true) }, { (EStat)41, ("Powerup Chance", true) }, { (EStat)40, ("Powerup Multiplier", true) }, { (EStat)46, ("Extra Jumps", false) } }; public override string Id => "EliteSlayer"; public override string DisplayName => "Elite Slayer"; public override string Description => "Each elite kill grants a small random permanent stat boost (kept for the rest of the run). Hold Tab (or open Pause) to see this stage's accumulated bonuses."; public override bool BlocksLeaderboard => true; public EliteSlayerFeature() { _instance = this; } public override void BindConfig(ConfigFile cfg) { base.BindConfig(cfg); BoostMultiplier = cfg.Bind(Id, "BoostMultiplier", 1f, "Multiplier on each per-elite stat boost. 1.0 matches the original Rizzo video values; range 0.1 - 2.0."); } public override void ApplyPatches(Harmony harmony) { //IL_001a: 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) //IL_002b: Expected O, but got Unknown harmony.PatchAll(typeof(Patches)); ClassInjector.RegisterTypeInIl2Cpp(); GameObject val = new GameObject("Megamod_EliteSlayer"); val.AddComponent(); Object.DontDestroyOnLoad((Object)val); } public static string DisplayName_(EStat s) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (!StatDisplay.TryGetValue(s, out (string, bool) value)) { return ((object)(EStat)(ref s)).ToString(); } return value.Item1; } public static string FormatValue(EStat s, float value) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (StatDisplay.TryGetValue(s, out (string, bool) value2) && value2.Item2) { float num = value * 100f; if (num % 1f == 0f) { return $"{num:F0}%"; } return $"{num:F1}%"; } if (value % 1f == 0f) { return $"{value:F0}"; } return $"{value:G4}"; } } public sealed class EscalatingDifficultyFeature : ModFeature { public class EscalatingBehaviour : MonoBehaviour { private const float SKULEG_BASE = 60f; private const float OLDMASK_BASE = 120f; private const float MIN_INTERVAL = 30f; private const float RAMP_RATE = 0.96f; private MyPlayer _lastPlayer; private bool _itemsResolved; private EItem _skuleg; private EItem _oldMask; private float _skulegTimer; private float _oldMaskTimer; private float _skulegInterval = 60f; private float _oldMaskInterval = 120f; public EscalatingBehaviour(IntPtr ptr) : base(ptr) { } private void Update() { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsEnabled()) { return; } GameManager instance = GameManager.Instance; MyPlayer val = ((instance != null) ? instance.player : null); if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)_lastPlayer) { _lastPlayer = val; _skulegTimer = 0f; _oldMaskTimer = 0f; _skulegInterval = 60f; _oldMaskInterval = 120f; } if ((Object)(object)val == (Object)null || (!_itemsResolved && !TryResolveItems()) || Time.timeScale < 0.01f || (int)Cursor.lockState == 0) { return; } float deltaTime = Time.deltaTime; _skulegTimer += deltaTime; _oldMaskTimer += deltaTime; if (_skulegTimer >= _skulegInterval) { _skulegTimer = 0f; try { val.inventory.itemInventory.AddItem(_skuleg); } catch { } _skulegInterval = Math.Max(30f, _skulegInterval * 0.96f); } if (_oldMaskTimer >= _oldMaskInterval) { _oldMaskTimer = 0f; try { val.inventory.itemInventory.AddItem(_oldMask); } catch { } _oldMaskInterval = Math.Max(30f, _oldMaskInterval * 0.96f); } } private bool TryResolveItems() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) try { if (Enum.TryParse("Skuleg", out EItem result) && Enum.TryParse("OldMask", out EItem result2)) { _skuleg = result; _oldMask = result2; _itemsResolved = true; return true; } } catch { } return false; } } public override string Id => "EscalatingDifficulty"; public override string DisplayName => "Escalating Difficulty"; public override string Description => "Periodically auto-feeds Skuleg + Old Mask to the player to ramp difficulty over time."; public override bool BlocksLeaderboard => true; public override void ApplyPatches(Harmony harmony) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown ClassInjector.RegisterTypeInIl2Cpp(); GameObject val = new GameObject("Megamod_EscalatingDifficulty") { hideFlags = (HideFlags)61 }; val.AddComponent(); Object.DontDestroyOnLoad((Object)val); } } public sealed class ItemHotkeysFeature : ModFeature { private struct Binding { public EItem Item; public int Amount; public KeyCode Key; } public class HotkeyBehaviour : MonoBehaviour { private readonly List _bindings = new List(); private string _lastParsed; public HotkeyBehaviour(IntPtr ptr) : base(ptr) { } private void Update() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsEnabled() || MegaMenu.IsOpen) { return; } string text = _instance.Bindings?.Value ?? ""; if (text != _lastParsed) { _lastParsed = text; Reparse(text); } if (_bindings.Count == 0) { return; } GameManager instance = GameManager.Instance; object obj; if (instance == null) { obj = null; } else { MyPlayer player = instance.player; if (player == null) { obj = null; } else { PlayerInventory inventory = player.inventory; obj = ((inventory != null) ? inventory.itemInventory : null); } } ItemInventory val = (ItemInventory)obj; if (val == null) { return; } bool flag = default(bool); for (int i = 0; i < _bindings.Count; i++) { Binding binding = _bindings[i]; if (Input.GetKeyDown(binding.Key)) { for (int j = 0; j < binding.Amount; j++) { val.AddItem(binding.Item); } ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(20, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[ItemHotkeys] "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(binding.Key); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" -> "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(binding.Amount); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("× "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(binding.Item); } log.LogInfo(val2); } } } private void Reparse(string raw) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) _bindings.Clear(); if (string.IsNullOrWhiteSpace(raw)) { return; } string[] array = raw.Split(';'); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(':'); if (array2.Length == 3 && Enum.TryParse(array2[0].Trim(), ignoreCase: true, out EItem result) && int.TryParse(array2[1].Trim(), out var result2) && result2 >= 1 && Enum.TryParse(array2[2].Trim(), ignoreCase: true, out KeyCode result3)) { _bindings.Add(new Binding { Item = result, Amount = result2, Key = result3 }); } } ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ItemHotkeys] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_bindings.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" binding(s) loaded"); } log.LogInfo(val); } } public ConfigEntry Bindings; private static ItemHotkeysFeature _instance; public override string Id => "ItemHotkeys"; public override string DisplayName => "Item Hotkeys"; public override string Description => "User-defined keybinds for spawning items. Configure in the launcher: each binding is Item × Amount → Key."; public override bool BlocksLeaderboard => true; public ItemHotkeysFeature() { _instance = this; } public override void BindConfig(ConfigFile cfg) { base.BindConfig(cfg); Bindings = cfg.Bind(Id, "Bindings", "", "Semicolon-separated list of Item:Amount:Hotkey triples. Example: Anvil:5:F9;Borgar:5:F8;Clover:1:F3"); } public override void ApplyPatches(Harmony harmony) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown ClassInjector.RegisterTypeInIl2Cpp(); GameObject val = new GameObject("Megamod_ItemHotkeys") { hideFlags = (HideFlags)61 }; val.AddComponent(); Object.DontDestroyOnLoad((Object)val); } } public sealed class ItemUpgraderFeature : ModFeature { public class UpgraderBehaviour : MonoBehaviour { private const float UPGRADE_INTERVAL = 60f; private const float BASE_CHANCE = 0.1f; private static readonly Random Rng = new Random(); private MyPlayer _lastPlayer; private float _timer; private int _upgradeCount; private float _currentChance; private bool _active; private GUIStyle _boxStyle; private GUIStyle _labelStyle; private GUIStyle _headerStyle; public UpgraderBehaviour(IntPtr ptr) : base(ptr) { } private void Update() { _active = false; if (!Plugin.IsEnabled()) { return; } GameManager instance = GameManager.Instance; MyPlayer val = ((instance != null) ? instance.player : null); if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)_lastPlayer) { _lastPlayer = val; _timer = 0f; _upgradeCount = 0; } if ((Object)(object)val == (Object)null) { return; } try { if (instance.uiManager.pause.IsPaused()) { return; } } catch { return; } _active = true; _currentChance = ComputeChance(ReadLuck(val)); _timer += Time.deltaTime; float num = Mathf.Max(5f, 60f - (float)_upgradeCount); if (_timer >= num) { _timer = 0f; AttemptUpgrade(val); } } private void OnGUI() { //IL_0048: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) if (_active && !MegaMenu.IsOpen) { EnsureStyles(); float num = (float)Screen.width - 240f - 20f; float num2 = (float)Screen.height - 78f - 65f; GUI.Box(new Rect(num, num2, 240f, 78f), GUIContent.none, _boxStyle); float num3 = num + 10f; float num4 = num2 + 6f; GUI.Label(new Rect(num3, num4, 220f, 24f), "ITEM UPGRADER", _headerStyle); num4 += 24f; float num5 = Mathf.Max(5f, 60f - (float)_upgradeCount); float num6 = Mathf.Max(0f, num5 - _timer); string text = ((num6 >= 60f) ? $"{(int)(num6 / 60f)}:{(int)num6 % 60:D2}" : $"{num6:F0}s"); GUI.Label(new Rect(num3, num4, 220f, 22f), "Next attempt in " + text + "", _labelStyle); num4 += 22f; string text2 = $"{_currentChance * 100f:F1}%"; GUI.Label(new Rect(num3, num4, 220f, 22f), "Chance: " + text2 + "", _labelStyle); } } private void EnsureStyles() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown if (_boxStyle == null || _boxStyle.normal == null || !((Object)(object)_boxStyle.normal.background != (Object)null)) { Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.75f)); val.Apply(); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); GUIStyle val2 = new GUIStyle(GUI.skin.box); val2.normal.background = val; _boxStyle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 16, richText = true }; val3.normal.textColor = Color.white; _labelStyle = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 18, fontStyle = (FontStyle)1, richText = true }; val4.normal.textColor = new Color(1f, 0.84f, 0f); _headerStyle = val4; } } private float ReadLuck(MyPlayer player) { try { PlayerInventory inventory = player.inventory; PlayerStatsNew val = ((inventory != null) ? inventory.playerStats : null); if (val == null) { return 0f; } return val.GetStat((EStat)30); } catch { return 0f; } } private float ComputeChance(float luck) { luck = Math.Max(luck, 0f); float num = Mathf.Clamp((Instance?.ChanceMultiplier?.Value).GetValueOrDefault(1f), 0.1f, 2f); return Mathf.Clamp((0.1f + (float)Math.Log((double)luck + 1.0) * 0.2886f) * num, 0f, 0.95f); } private void AttemptUpgrade(MyPlayer player) { //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Invalid comparison between Unknown and I4 //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Invalid comparison between Unknown and I4 //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) try { float num = ComputeChance(ReadLuck(player)); if (Rng.NextDouble() >= (double)num) { try { GameManager instance = GameManager.Instance; object obj; if (instance == null) { obj = null; } else { UiManager uiManager = instance.uiManager; obj = ((uiManager != null) ? uiManager.scoreUi : null); } ScoreUi val = (ScoreUi)obj; if ((Object)(object)val != (Object)null) { val.AddScore($"{num * 100f:F0}%", "MISS", false, false, 1f); } return; } catch { return; } } ItemInventory itemInventory = player.inventory.itemInventory; if (((itemInventory != null) ? itemInventory.items : null) == null || itemInventory.items.Count == 0) { return; } DataManager dataManager = AlwaysManager.Instance.dataManager; List<(EItem, EItemRarity)> list = new List<(EItem, EItemRarity)>(); Enumerator enumerator = itemInventory.items.GetEnumerator(); while (enumerator.MoveNext()) { EItem key = enumerator.Current.Key; ItemData item = dataManager.GetItem(key); if (!((Object)(object)item == (Object)null)) { EItemRarity rarity = item.rarity; if ((int)rarity == 0 || (int)rarity == 1 || (int)rarity == 2) { list.Add((key, rarity)); } } } if (list.Count == 0) { return; } (EItem, EItemRarity) tuple = list[Rng.Next(list.Count)]; EItemRarity val2 = (EItemRarity)(tuple.Item2 + 1); HashSet hashSet = new HashSet(); List list2 = new List(); for (int i = 0; i < 10; i++) { List randomItemsShadyGuy = InventoryUtility.GetRandomItemsShadyGuy(val2); if (randomItemsShadyGuy == null) { continue; } for (int j = 0; j < randomItemsShadyGuy.Count; j++) { ItemData val3 = randomItemsShadyGuy[j]; if (val3.rarity == val2 && hashSet.Add(val3.eItem)) { list2.Add(val3.eItem); } } } if (list2.Count == 0) { return; } EItem val4 = list2[Rng.Next(list2.Count)]; itemInventory.RemoveItem(tuple.Item1, false); itemInventory.AddItem(val4); _upgradeCount++; try { GameManager instance2 = GameManager.Instance; object obj3; if (instance2 == null) { obj3 = null; } else { UiManager uiManager2 = instance2.uiManager; obj3 = ((uiManager2 != null) ? uiManager2.scoreUi : null); } ScoreUi val5 = (ScoreUi)obj3; if ((Object)(object)val5 != (Object)null) { ItemData item2 = dataManager.GetItem(val4); string text = (((Object)(object)item2 != (Object)null && !string.IsNullOrEmpty(((Object)item2).name)) ? ((Object)item2).name : ((object)(EItem)(ref val4)).ToString()); val5.AddScore(text, "UPGRADED!", true, true, 1.5f); } } catch { } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val6 = new BepInExErrorLogInterpolatedStringHandler(31, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[ItemUpgrader] attempt failed: "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(ex.Message); } log.LogError(val6); } } } public ConfigEntry ChanceMultiplier; internal static ItemUpgraderFeature Instance; public override string Id => "ItemUpgrader"; public override string DisplayName => "Item Upgrader"; public override string Description => "Periodically rolls a luck-scaled chance to upgrade a random non-legendary item to the next rarity. Rolls speed up the more upgrades you've earned this run."; public override bool BlocksLeaderboard => true; public ItemUpgraderFeature() { Instance = this; } public override void BindConfig(ConfigFile cfg) { base.BindConfig(cfg); ChanceMultiplier = cfg.Bind(Id, "ChanceMultiplier", 1f, "Multiplier on the upgrade roll chance. 1.0 = original; range 0.1 - 2.0."); } public override void ApplyPatches(Harmony harmony) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown ClassInjector.RegisterTypeInIl2Cpp(); GameObject val = new GameObject("Megamod_ItemUpgrader") { hideFlags = (HideFlags)61 }; val.AddComponent(); Object.DontDestroyOnLoad((Object)val); } } public sealed class LevelUncapFeature : ModFeature { private static class Patches { private static int _topXp = -1; private static int _costAtTop = -1; private static int _origMaxLevel = -1; private static bool _initFailed; private static bool TryInitFromTable() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown if (_costAtTop > 0) { return true; } if (_initFailed) { return false; } try { Il2CppStructArray xpForLevelsTable = XpUtility.xpForLevelsTable; if (xpForLevelsTable == null) { return false; } int length = ((Il2CppArrayBase)(object)xpForLevelsTable).Length; if (length < 2) { return false; } _origMaxLevel = length - 1; _topXp = ((Il2CppArrayBase)(object)xpForLevelsTable)[length - 1]; int num = ((Il2CppArrayBase)(object)xpForLevelsTable)[length - 2]; _costAtTop = _topXp - num; if (_costAtTop <= 0) { _costAtTop = 1; } return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[LevelUncap] XpToLevel init failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex.Message); } log.LogWarning(val); _initFailed = true; return false; } } [HarmonyPatch(typeof(XpUtility), "XpToLevel")] [HarmonyPostfix] private static void XpToLevel_Postfix(int xp, ref int __result) { if (Plugin.IsEnabled() && TryInitFromTable() && xp > _topXp) { long num = ((long)xp - (long)_topXp) / _costAtTop; long num2 = _origMaxLevel + num; __result = (int)((num2 > int.MaxValue) ? int.MaxValue : num2); } } [HarmonyPatch(typeof(PlayerXp), "AddXp")] [HarmonyPrefix] private static void AddXp_Prefix() { if (Plugin.IsEnabled() && PlayerXp.maxXpMultiplier < 999999f) { PlayerXp.maxXpMultiplier = 999999f; } } [HarmonyPatch(typeof(PlayerStatsNew), "GetStat")] [HarmonyPostfix] private static void GetStat_Postfix(PlayerStatsNew __instance, EStat stat, ref float __result) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsEnabled() || (int)stat != 32) { return; } try { float unclampedStat = __instance.GetUnclampedStat(stat); if (unclampedStat > __result) { __result = unclampedStat; } } catch { } } [HarmonyPatch(typeof(StatEntry), "Set")] [HarmonyPostfix] private static void StatEntrySet_Postfix(StatEntry __instance, EStat stat) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 if (!Plugin.IsEnabled() || (int)stat != 32) { return; } try { GameManager instance = GameManager.Instance; object obj; if (instance == null) { obj = null; } else { MyPlayer player = instance.player; if (player == null) { obj = null; } else { PlayerInventory inventory = player.inventory; obj = ((inventory != null) ? inventory.playerStats : null); } } PlayerStatsNew val = (PlayerStatsNew)obj; if (val != null) { float unclampedStat = val.GetUnclampedStat((EStat)32); if ((Object)(object)__instance.t_value != (Object)null) { ((TMP_Text)__instance.t_value).text = unclampedStat.ToString("0.0") + "x"; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(28, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[LevelUncap] StatEntry.Set: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log.LogWarning(val2); } } } public const float NewMaxXpMultiplier = 999999f; public override string Id => "LevelUncap"; public override string DisplayName => "Level Uncap"; public override string Description => "Removes the 10x XP-gain cap and the 9999 level cap (extrapolates past the table)."; public override bool BlocksLeaderboard => true; public override void ApplyPatches(Harmony harmony) { harmony.PatchAll(typeof(Patches)); } } public sealed class MultiPassiveFeature : ModFeature { public class MultiPassiveBehaviour : MonoBehaviour { private class ExtraPassive { public PassiveAbility passive; public string charName = ""; public string statPrefix = ""; } private readonly List _extra = new List(); private readonly Dictionary _syncedValues = new Dictionary(); private readonly HashSet _movingStatNames = new HashSet(); private MyPlayer _lastPlayer; private bool _wasEnabled; public MultiPassiveBehaviour(IntPtr ptr) : base(ptr) { } private void Update() { bool flag = Plugin.IsEnabled(); if (_wasEnabled && !flag) { Cleanup(); _wasEnabled = false; return; } if (!_wasEnabled && flag && (Object)(object)_lastPlayer != (Object)null) { Cleanup(); Init(_lastPlayer); _wasEnabled = true; } if (flag) { GameManager instance = GameManager.Instance; MyPlayer val = ((instance != null) ? instance.player : null); if ((Object)(object)val == (Object)null && (Object)(object)_lastPlayer != (Object)null) { Cleanup(); _lastPlayer = null; } else if (!((Object)(object)val == (Object)null) && (Object)(object)val != (Object)(object)_lastPlayer) { _lastPlayer = val; Cleanup(); Init(val); _wasEnabled = true; } } } private void FixedUpdate() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown if (!Plugin.IsEnabled()) { return; } GameManager instance = GameManager.Instance; MyPlayer val = ((instance != null) ? instance.player : null); if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)_lastPlayer || _extra.Count == 0) { return; } bool flag = default(bool); for (int i = 0; i < _extra.Count; i++) { try { _extra[i].passive.Tick(); } catch (Exception ex) { ManualLogSource log = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(33, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[MultiPassive] Tick failed for "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(_extra[i].charName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log.LogError(val2); } } SyncStats(); } private HashSet ParseSelection() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(); string[] array = (_instance.ActivePassives?.Value ?? "").Split(','); for (int i = 0; i < array.Length; i++) { string value = array[i].Trim(); if (!string.IsNullOrEmpty(value) && Enum.TryParse(value, ignoreCase: true, out ECharacter result)) { hashSet.Add(result); } } return hashSet; } private void Init(MyPlayer player) { //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); try { AlwaysManager instance = AlwaysManager.Instance; DataManager val = ((instance != null) ? instance.dataManager : null); if ((Object)(object)val == (Object)null) { return; } ECharacter? val2 = null; try { val2 = player.character; } catch { } foreach (ECharacter item in ParseSelection()) { ECharacter current = item; if (val2.HasValue && current == val2.Value) { continue; } try { CharacterData characterData = val.GetCharacterData(current); if ((Object)(object)characterData == (Object)null) { continue; } PassiveData passive = characterData.passive; if (!((Object)(object)passive == (Object)null)) { PassiveAbility val3 = PassiveAbilityFactory.CreatePassiveAbility(passive); if (val3 != null) { val3.Init(); _extra.Add(new ExtraPassive { passive = val3, charName = ((object)(ECharacter)(ref current)).ToString(), statPrefix = $"Megamod_MultiPassive_{current}_" }); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(22, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[MultiPassive] init "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(current); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(ex.Message); } log.LogWarning(val4); } } SyncStats(); ManualLogSource log2 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(40, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[MultiPassive] granted "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(_extra.Count); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" extra passive(s)"); } log2.LogInfo(val5); } catch (Exception ex2) { ManualLogSource log3 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val6 = new BepInExErrorLogInterpolatedStringHandler(28, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[MultiPassive] init failed: "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(ex2.Message); } log3.LogError(val6); } } private void SyncStats() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) GameManager instance = GameManager.Instance; object obj; if (instance == null) { obj = null; } else { MyPlayer player = instance.player; if (player == null) { obj = null; } else { PlayerInventory inventory = player.inventory; obj = ((inventory != null) ? inventory.statInventory : null); } } StatInventory val = (StatInventory)obj; if (val == null) { return; } for (int i = 0; i < _extra.Count; i++) { ExtraPassive extraPassive = _extra[i]; Dictionary statModifiers = extraPassive.passive.statModifiers; if (statModifiers == null) { continue; } Enumerator enumerator = statModifiers.GetEnumerator(); while (enumerator.MoveNext()) { EStat key = enumerator.Current.Key; StatModifiersContainer value = enumerator.Current.Value; if (value == null || value.statContainers == null) { continue; } Enumerator enumerator2 = value.statContainers.GetEnumerator(); while (enumerator2.MoveNext()) { EStatModifyType key2 = enumerator2.Current.Key; StatModifier value2 = enumerator2.Current.Value; string text = $"{extraPassive.statPrefix}{key}_{key2}"; float modification = value2.modification; if (!_syncedValues.TryGetValue(text, out var value3) || !(Math.Abs(value3 - modification) < 0.0001f)) { _syncedValues[text] = modification; _movingStatNames.Add(text); val.ChangeMovingStat(text, value2); } } } } } private void Cleanup() { GameManager instance = GameManager.Instance; object obj; if (instance == null) { obj = null; } else { MyPlayer player = instance.player; if (player == null) { obj = null; } else { PlayerInventory inventory = player.inventory; obj = ((inventory != null) ? inventory.statInventory : null); } } StatInventory val = (StatInventory)obj; if (val != null) { foreach (string movingStatName in _movingStatNames) { try { val.RemoveMovingStat(movingStatName); } catch { } } } _syncedValues.Clear(); _movingStatNames.Clear(); for (int i = 0; i < _extra.Count; i++) { try { _extra[i].passive.Cleanup(); } catch { } } _extra.Clear(); } } public ConfigEntry ActivePassives; private static MultiPassiveFeature _instance; public override string Id => "MultiPassive"; public override string DisplayName => "Multi Passive"; public override string Description => "Auto-grants the passive abilities of every checked character at run start, stacked on top of your own character's passive."; public override bool BlocksLeaderboard => true; public MultiPassiveFeature() { _instance = this; } public override void BindConfig(ConfigFile cfg) { base.BindConfig(cfg); ActivePassives = cfg.Bind(Id, "ActivePassives", "", "Comma-separated ECharacter names whose passives are granted (e.g. Bush,Athena). Configured via the launcher menu's checkbox list."); } public override void ApplyPatches(Harmony harmony) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown ClassInjector.RegisterTypeInIl2Cpp(); GameObject val = new GameObject("Megamod_MultiPassive"); val.AddComponent(); Object.DontDestroyOnLoad((Object)val); } } public sealed class OneShotFeature : ModFeature { private static class Patches { private static bool _allowZaWarudo; private static Action _savedCheckStopDamageEvent; [HarmonyPatch(typeof(PlayerHealth), "DamagePlayer", new Type[] { typeof(Enemy), typeof(Vector3), typeof(DcFlags) })] [HarmonyPrefix] private static bool DamagePlayer_Prefix(PlayerHealth __instance) { if (!Plugin.IsEnabled()) { return true; } GameManager instance = GameManager.Instance; object obj; if (instance == null) { obj = null; } else { MyPlayer player = instance.player; if (player == null) { obj = null; } else { PlayerInventory inventory = player.inventory; obj = ((inventory != null) ? inventory.itemInventory : null); } } ItemInventory val = (ItemInventory)obj; if (val != null && val.items.ContainsKey((EItem)25)) { _allowZaWarudo = true; _savedCheckStopDamageEvent = PlayerHealth.A_CheckStopDamage; PlayerHealth.A_CheckStopDamage = null; return true; } __instance.KillPlayer(); return false; } [HarmonyPatch(typeof(PlayerHealth), "DamagePlayer", new Type[] { typeof(Enemy), typeof(Vector3), typeof(DcFlags) })] [HarmonyPostfix] private static void DamagePlayer_Postfix() { if (_allowZaWarudo) { PlayerHealth.A_CheckStopDamage = _savedCheckStopDamageEvent; _savedCheckStopDamageEvent = null; _allowZaWarudo = false; } } [HarmonyPatch(typeof(PlayerHealth), "Damage", new Type[] { typeof(DamageContainer), typeof(bool) })] [HarmonyPrefix] private static void Damage_Prefix(DamageContainer dc, ref bool ignoreShield) { if (Plugin.IsEnabled()) { dc.damage = 999999f; ignoreShield = true; dc.flags = (DcFlags)21; } } [HarmonyPatch(typeof(PlayerHealth), "CheckStopDamage", new Type[] { typeof(DamageContainer), typeof(bool) })] [HarmonyPrefix] private static void CheckStopDamage_Prefix(DamageContainer dc, ref bool ignoreShield) { if (Plugin.IsEnabled() && _allowZaWarudo) { ignoreShield = true; dc.flags = (DcFlags)21; } } [HarmonyPatch(typeof(PlayerHealth), "CheckStopDamage", new Type[] { typeof(DamageContainer), typeof(bool) })] [HarmonyPostfix] private static void CheckStopDamage_Postfix(ref bool __result) { if (Plugin.IsEnabled() && !_allowZaWarudo) { __result = false; } } } public override string Id => "OneShot"; public override string DisplayName => "One Shot"; public override string Description => "Player dies in a single hit from any damage source. ZaWarudo still saves you (other save items like Mirror are bypassed)."; public override bool BlocksLeaderboard => true; public override void ApplyPatches(Harmony harmony) { harmony.PatchAll(typeof(Patches)); } } public sealed class PotLuckFeature : ModFeature { private static class Patches { [HarmonyPatch(typeof(InteractablePot), "Interact")] [HarmonyPrefix] private static void PotInteract_Prefix(InteractablePot __instance) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown if (!Plugin.IsEnabled()) { return; } PotLuckManager instance = PotLuckManager.Instance; if ((Object)(object)instance == (Object)null) { return; } try { float lastInjectedValue = (__instance.luckPerPot = PotLuckManager.ComputePotLuck(instance.PotsBrokenThisRun + 1)); instance.LastInjectedValue = lastInjectedValue; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(27, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PotLuck] Interact prefix: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex.Message); } log.LogError(val); } } [HarmonyPatch(typeof(InteractablePot), "Interact")] [HarmonyPostfix] private static void PotInteract_Postfix(InteractablePot __instance, bool __result) { if (Plugin.IsEnabled() && __result) { PotLuckManager instance = PotLuckManager.Instance; if (!((Object)(object)instance == (Object)null)) { instance.OnPotBroken(instance.LastInjectedValue, instance.PotsBrokenThisRun + 1); } } } [HarmonyPatch(typeof(ItemClover), "OnInitOrAmountChanged")] [HarmonyPrefix] private static bool Clover_Init_Prefix() { return !Plugin.IsEnabled(); } [HarmonyPatch(typeof(ItemClover), "GetDescription")] [HarmonyPrefix] private static bool Clover_Desc_Prefix(ref string __result) { if (!Plugin.IsEnabled()) { return true; } float value = (((Object)(object)PotLuckManager.Instance != (Object)null) ? (PotLuckManager.Instance.CloverLuckTotal * 100f) : 0f); float value2 = 50f; __result = $"Each Clover gains +{0.1f:F1}% Luck per second (max {value2:F0}% each)\nCurrently: +{value:F1}% total"; return false; } [HarmonyPatch(typeof(EncounterUtility), "GetRandomStatOffers")] [HarmonyPostfix] private static void GetRandomStatOffers_Postfix(List __result) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 if (!Plugin.IsEnabled() || __result == null) { return; } try { for (int i = 0; i < __result.Count; i++) { EncounterOffer val = __result[i]; if (((val != null) ? val.effects : null) == null) { continue; } for (int j = 0; j < ((Il2CppArrayBase)(object)val.effects).Length; j++) { EffectStat val2 = ((Il2CppArrayBase)(object)val.effects)[j]; if (((val2 != null) ? val2.statModifier : null) != null && (int)val2.statModifier.stat == 30) { StatModifier statModifier = val2.statModifier; statModifier.modification *= 2f; } } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PotLuck] shrine luck: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex.Message); } log.LogError(val3); } } } public class PotLuckManager : MonoBehaviour { public static PotLuckManager Instance; public const float POT_MIN = 0.005f; public const float POT_MAX = 0.08f; public const float CURVE_POWER = 0.9f; public const int TOTAL_POTS = 55; public const float CLOVER_RATE = 0.001f; public const float CLOVER_CAP = 0.5f; private const string CLOVER_STAT_NAME = "potluck_clover"; public int PotsBrokenThisRun; public int PotsBrokenThisStage; public float CloverLuckTotal; public float LastInjectedValue; private readonly List _cloverTimers = new List(); private IntPtr _lastPlayerPtr; private int _lastStageIndex = -1; public PotLuckManager(IntPtr ptr) : base(ptr) { } private void Awake() { Instance = this; } public static float ComputePotLuck(int potNumber) { float x = Math.Clamp((float)(potNumber - 1) / 54f, 0f, 1f); float num = Mathf.Clamp((PotLuckFeature.Instance?.LuckMultiplier?.Value).GetValueOrDefault(1f), 0.1f, 2f); return (0.005f + 0.074999996f * MathF.Pow(x, 0.9f)) * num; } public void OnPotBroken(float luckInjected, int potNumber) { PotsBrokenThisRun++; PotsBrokenThisStage++; } private void ResetRun() { PotsBrokenThisRun = 0; PotsBrokenThisStage = 0; CloverLuckTotal = 0f; _cloverTimers.Clear(); } private void Update() { if (!Plugin.IsEnabled()) { if (!(CloverLuckTotal > 0f)) { return; } GameManager instance = GameManager.Instance; object obj; if (instance == null) { obj = null; } else { MyPlayer player = instance.player; if (player == null) { obj = null; } else { PlayerInventory inventory = player.inventory; obj = ((inventory != null) ? inventory.statInventory : null); } } StatInventory val = (StatInventory)obj; if (val != null) { try { val.RemoveMovingStat("potluck_clover"); } catch { } } CloverLuckTotal = 0f; return; } GameManager instance2 = GameManager.Instance; if ((Object)(object)((instance2 != null) ? instance2.player : null) == (Object)null) { return; } IntPtr pointer = ((Il2CppObjectBase)instance2.player).Pointer; int num = 0; try { num = MapController.GetStageIndex(); } catch { } if (_lastPlayerPtr != IntPtr.Zero && pointer != _lastPlayerPtr) { if (num == 0) { ResetRun(); } _lastStageIndex = num; } if (num != _lastStageIndex && _lastStageIndex >= 0) { if (num == 0 && _lastStageIndex > 0) { ResetRun(); } _lastStageIndex = num; } _lastPlayerPtr = pointer; UpdateCloverTimer(instance2); } private void UpdateCloverTimer(GameManager gm) { //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown try { PlayerInventory inventory = gm.player.inventory; ItemInventory val = ((inventory != null) ? inventory.itemInventory : null); if (((val != null) ? val.items : null) == null) { return; } bool flag = val.items.ContainsKey((EItem)35); int num = (flag ? val.items[(EItem)35].amount : 0); while (_cloverTimers.Count < num) { _cloverTimers.Add(0f); } while (_cloverTimers.Count > num) { _cloverTimers.RemoveAt(_cloverTimers.Count - 1); } if (flag) { float num2 = 0f; float deltaTime = Time.deltaTime; for (int i = 0; i < _cloverTimers.Count; i++) { if (_cloverTimers[i] < 0.5f) { _cloverTimers[i] += 0.001f * deltaTime; if (_cloverTimers[i] > 0.5f) { _cloverTimers[i] = 0.5f; } } num2 += _cloverTimers[i]; } CloverLuckTotal = num2; StatModifier val2 = new StatModifier(); val2.stat = (EStat)30; val2.modifyType = (EStatModifyType)2; val2.modification = CloverLuckTotal; gm.player.inventory.statInventory.ChangeMovingStat("potluck_clover", val2); } else if (CloverLuckTotal > 0f) { try { gm.player.inventory.statInventory.RemoveMovingStat("potluck_clover"); return; } catch { return; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag2 = default(bool); BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PotLuck] Clover timer: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex.Message); } log.LogError(val3); } } } public ConfigEntry LuckMultiplier; internal static PotLuckFeature Instance; public override string Id => "PotLuck"; public override string DisplayName => "Pot Luck Rebalance"; public override string Description => "Rebalances pot interactions on a 0.5%–8% curve, gives Clover a passive +0.1%/s timer (cap 50% per Clover), and doubles shrine luck offers."; public override bool BlocksLeaderboard => true; public PotLuckFeature() { Instance = this; } public override void BindConfig(ConfigFile cfg) { base.BindConfig(cfg); LuckMultiplier = cfg.Bind(Id, "LuckMultiplier", 1f, "Multiplier on per-pot luck values. 1.0 = original 0.5%-8% curve; range 0.1 - 2.0."); } public override void ApplyPatches(Harmony harmony) { //IL_001a: 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) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown ClassInjector.RegisterTypeInIl2Cpp(); harmony.PatchAll(typeof(Patches)); GameObject val = new GameObject("Megamod_PotLuck") { hideFlags = (HideFlags)61 }; val.AddComponent(); Object.DontDestroyOnLoad((Object)val); } } public sealed class PumpkinStackerFeature : ModFeature { private static class Patches { private static bool _suppressing; [HarmonyPatch(typeof(ItemInventory), "AddItem", new Type[] { typeof(EItem) })] [HarmonyPostfix] private static void AddItem_Postfix(ItemInventory __instance, EItem eItem) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsEnabled() || !StackerBehaviour.Resolved || _suppressing || eItem == StackerBehaviour.Pumpkin) { return; } _suppressing = true; try { __instance.AddItem(StackerBehaviour.Pumpkin); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[PumpkinStacker] add pumpkin: " + ex.Message)); } finally { _suppressing = false; } } } public class StackerBehaviour : MonoBehaviour { public static bool Resolved; public static EItem Pumpkin; private MyPlayer _lastPlayer; private bool _startingGiven; public StackerBehaviour(IntPtr ptr) : base(ptr) { } private void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (Enum.TryParse("Pumpkin", out EItem result)) { Pumpkin = result; Resolved = true; } else { Plugin.Log.LogError((object)"[PumpkinStacker] EItem.Pumpkin not found"); } } private void Update() { if (!Plugin.IsEnabled()) { return; } GameManager instance = GameManager.Instance; MyPlayer val = ((instance != null) ? instance.player : null); if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)_lastPlayer) { _lastPlayer = val; _startingGiven = false; if (Resolved) { GiveStarting(val); } } if ((Object)(object)val == (Object)null && (Object)(object)_lastPlayer != (Object)null) { _lastPlayer = null; _startingGiven = false; } } private void GiveStarting(MyPlayer player) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (_startingGiven) { return; } _startingGiven = true; try { int value = _instance.StartingPumpkins.Value; if (value <= 0) { return; } player.inventory.itemInventory.AddItem(Pumpkin, value); try { GameManager instance = GameManager.Instance; object obj; if (instance == null) { obj = null; } else { UiManager uiManager = instance.uiManager; obj = ((uiManager != null) ? uiManager.scoreUi : null); } ScoreUi val = (ScoreUi)obj; if ((Object)(object)val != (Object)null) { val.AddScore($"{value} Pumpkins!", "PUMPKIN STACKER", true, true, 1.5f); } } catch { } } catch (Exception ex) { Plugin.Log.LogError((object)("[PumpkinStacker] starting items: " + ex.Message)); _startingGiven = false; } } } public ConfigEntry StartingPumpkins; private static PumpkinStackerFeature _instance; public override string Id => "PumpkinStacker"; public override string DisplayName => "Pumpkin Stacker"; public override string Description => "Every non-pumpkin item pickup also adds a Pumpkin. Starts each run with N Pumpkins."; public override bool BlocksLeaderboard => true; public PumpkinStackerFeature() { _instance = this; } public override void BindConfig(ConfigFile cfg) { base.BindConfig(cfg); StartingPumpkins = cfg.Bind(Id, "StartingPumpkins", 5, "Number of Pumpkins granted at the start of each run."); } public override void ApplyPatches(Harmony harmony) { //IL_001a: 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) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown harmony.PatchAll(typeof(Patches)); ClassInjector.RegisterTypeInIl2Cpp(); GameObject val = new GameObject("Megamod_PumpkinStacker") { hideFlags = (HideFlags)61 }; val.AddComponent(); Object.DontDestroyOnLoad((Object)val); } } public sealed class TomeUncapFeature : ModFeature { private static class Patches { [HarmonyPatch(typeof(TomeData), "GetMaxLevel")] [HarmonyPostfix] private static void GetMaxLevel_Postfix(TomeData __instance, ref int __result) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (Plugin.IsEnabled() && IsUncapped(__instance.eTome)) { __result = int.MaxValue; } } [HarmonyPatch(typeof(TomeInventory), "IsMaxLevel")] [HarmonyPostfix] private static void IsMaxLevel_Postfix(ETome eTome, ref bool __result) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (Plugin.IsEnabled() && IsUncapped(eTome)) { __result = false; } } } public ConfigEntry UncappedTomes; private static TomeUncapFeature _instance = null; private static readonly HashSet _set = new HashSet(); private static string _lastCsv = null; public override string Id => "TomeUncap"; public override string DisplayName => "Tome Uncap"; public override string Description => "Removes the per-tome level cap on every tome whose name appears in the list."; public override bool BlocksLeaderboard => true; public TomeUncapFeature() { _instance = this; } public override void BindConfig(ConfigFile cfg) { base.BindConfig(cfg); UncappedTomes = cfg.Bind(Id, "UncappedTomes", "Chaos", "Comma-separated tome names to uncap. Set via the launcher menu's checkbox list."); } public static bool IsUncapped(ETome t) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) string text = _instance.UncappedTomes?.Value ?? ""; if (text != _lastCsv) { _lastCsv = text; _set.Clear(); string[] array = text.Split(','); for (int i = 0; i < array.Length; i++) { string value = array[i].Trim(); if (!string.IsNullOrEmpty(value) && Enum.TryParse(value, ignoreCase: true, out ETome result)) { _set.Add(result); } } } return _set.Contains(t); } public override void ApplyPatches(Harmony harmony) { harmony.PatchAll(typeof(Patches)); } } public sealed class UnlimitedBanishFeature : ModFeature { private static class Patches { [HarmonyPatch(typeof(LevelupScreen), "GetBanishes")] [HarmonyPostfix] private static void GetBanishes_Postfix(ref int __result) { if (!Plugin.IsEnabled()) { return; } UnlimitedBanishFeature instance = Instance; if (instance == null) { __result = 999; return; } ConfigEntry infinite = instance.Infinite; if (infinite == null || infinite.Value) { __result = 999; } else { __result = Mathf.Clamp(instance.BanishCount?.Value ?? 10, 1, 999); } } [HarmonyPatch(typeof(LevelupScreen), "DecrementBanishes")] [HarmonyPrefix] private static bool DecrementBanishes_Prefix() { if (!Plugin.IsEnabled()) { return true; } return !(Instance?.Infinite?.Value).GetValueOrDefault(true); } [HarmonyPatch(typeof(LevelupScreen), "RefreshUtilityButtons")] [HarmonyPostfix] private static void RefreshUtilityButtons_Postfix(LevelupScreen __instance) { if (Plugin.IsEnabled() && (Instance?.Infinite?.Value).GetValueOrDefault(true) && (Object)(object)__instance.b_banish != (Object)null && (Object)(object)__instance.b_banish.t_amount != (Object)null) { ((TMP_Text)__instance.b_banish.t_amount).text = "∞"; } } } public ConfigEntry Infinite; public ConfigEntry BanishCount; internal static UnlimitedBanishFeature Instance; public override string Id => "UnlimitedBanish"; public override string DisplayName => "Unlimited Banish"; public override string Description => "Removes the per-stage banish limit on the level-up screen. Either get infinite banishes (∞) or a fixed custom count per stage."; public override bool BlocksLeaderboard => true; public UnlimitedBanishFeature() { Instance = this; } public override void BindConfig(ConfigFile cfg) { base.BindConfig(cfg); Infinite = cfg.Bind(Id, "Infinite", true, "When true, banishes are unlimited (∞). When false, BanishCount is used instead."); BanishCount = cfg.Bind(Id, "BanishCount", 10, "Number of banishes available per stage when Infinite is off. Range 1 - 999."); } public override void ApplyPatches(Harmony harmony) { harmony.PatchAll(typeof(Patches)); } } }