Decompiled source of Megamod v0.5.1
BepInEx/plugins/Rizzotto-Megamod/RizzottoMegamod.dll
Decompiled 19 hours ago
The result has been truncated due to the large size, download it to view full contents!
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<string> _report = new List<string>(); private static readonly List<string> _errors = new List<string>(); 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<string>(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<string>(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<string> HiddenTomes = new HashSet<string> { "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<LeaderboardToggleBlocker>(); GameObject val = new GameObject("Megamod_LeaderboardToggleBlocker") { hideFlags = (HideFlags)61 }; val.AddComponent<LeaderboardToggleBlocker>(); 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<string>(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<string>(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<string>(methodName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(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<BetterSetting> val = Object.FindObjectsOfType<BetterSetting>(); 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<KeyCode> ToggleKey; private static MegaMenu _instance; private bool _open; private Vector2 _scroll; private string _itemSearch = ""; private readonly Dictionary<string, bool> _expanded = new Dictionary<string, bool>(); private readonly List<HotkeyRow> _hotkeyRows = new List<HotkeyRow>(); private bool _hotkeyRowsLoaded; private string _assignTarget = ""; private int _amountEditTarget = -1; private string _amountEditBuffer = ""; private string _configIntId = ""; private string _configIntBuffer = ""; private ConfigEntry<int> _configIntEntry; private int _configIntMin = 1; private int _configIntMax = int.MaxValue; private string _configFloatId = ""; private string _configFloatBuffer = ""; private ConfigEntry<float> _configFloatEntry; private float _configFloatMin; private float _configFloatMax = 1f; private float _savedTimeScale = 1f; private CursorLockMode _savedCursorLock; private bool _savedCursorVisible = true; private readonly List<GraphicRaycaster> _suppressedRaycasters = new List<GraphicRaycaster>(); 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<KeyCode>("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<GraphicRaycaster> val = Object.FindObjectsOfType<GraphicRaycaster>(); 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<KeyCode>(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<bool> 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<float> 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<float> 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<int> 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<float> 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<int> 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<string> csv, HashSet<string> 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<string> hashSet = new HashSet<string>(); 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<string> 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<bool> 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<bool>(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<T>() 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<MegaMenu>(); GameObject val = new GameObject("Megamod_MegaMenu") { hideFlags = (HideFlags)61 }; val.AddComponent<MegaMenu>(); Object.DontDestroyOnLoad((Object)val); ManualLogSource log = Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(42, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Press ["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<KeyCode>(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<Exception>(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<int>(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<AllWeaponsFeature>()) { 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<AllWeaponsFeature>()) { 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<AllWeaponsFeature>()) { 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<GameObject>(__instance.itemContainerPrefab, __instance.weaponParent).GetComponent<InventoryItemPrefabUI>(); 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<AllWeaponsFeature>()) { 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<GameObject>(__instance.itemContainerPrefab, __instance.weaponParent).GetComponent<InventoryItemPrefabUI>(); 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<AllWeaponsFeature>() || (int)encounterType != 0 || ((Il2CppObjectBase)__instance).Pointer == _expandedForPicker || __instance.buttons == null || ((Il2CppArrayBase<UpgradeButton>)(object)__instance.buttons).Length < 3) { return; } try { GameObject gameObject = ((Component)((Il2CppArrayBase<UpgradeButton>)(object)__instance.buttons)[0]).gameObject; Transform parent = gameObject.transform.parent; if (((Il2CppArrayBase<UpgradeButton>)(object)__instance.buttons).Length < 4) { GameObject obj = Object.Instantiate<GameObject>(gameObject, parent); ((Object)obj).name = "UpgradeButton_Modded"; UpgradeButton component = obj.GetComponent<UpgradeButton>(); if ((Object)(object)component == (Object)null) { return; } component.upgradePicker = __instance; Il2CppReferenceArray<UpgradeButton> val = new Il2CppReferenceArray<UpgradeButton>((long)(((Il2CppArrayBase<UpgradeButton>)(object)__instance.buttons).Length + 1)); for (int i = 0; i < ((Il2CppArrayBase<UpgradeButton>)(object)__instance.buttons).Length; i++) { ((Il2CppArrayBase<UpgradeButton>)(object)val)[i] = ((Il2CppArrayBase<UpgradeButton>)(object)__instance.buttons)[i]; } ((Il2CppArrayBase<UpgradeButton>)(object)val)[((Il2CppArrayBase<UpgradeButton>)(object)__instance.buttons).Length] = component; __instance.buttons = val; } RectTransform component2 = gameObject.GetComponent<RectTransform>(); 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<RectTransform>(); 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<string>(ex.Message); } log.LogError(val3); } } [HarmonyPatch(typeof(InventoryUtility), "GetRandomUpgrades")] [HarmonyPostfix] private static void GetRandomUpgrades_Postfix(List<IUpgradable> __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<AllWeaponsFeature>() || __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<WeaponData>() : null) != (Object)null) { num++; continue; } IUpgradable obj2 = __result[i]; if ((Object)(object)((obj2 != null) ? ((Il2CppObjectBase)obj2).TryCast<TomeData>() : null) != (Object)null) { num2++; } } HashSet<UnlockableBase> banishedUpgradables = RunUnlockables.banishedUpgradables; List<WeaponData> list = new List<WeaponData>(); List<WeaponData> 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<UnlockableBase>().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<WeaponData>() : null); if ((Object)(object)val4 != (Object)null && val4.eWeapon == val3.eWeapon) { flag2 = true; break; } } if (!flag2) { list.Add(val3); } } List<TomeData> list2 = new List<TomeData>(); List<TomeData> 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<UnlockableBase>())) || !((Il2CppObjectBase)val5).Cast<UnlockableBase>().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<TomeData>() : 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<IUpgradable>()); list2.RemoveAt(index); num2++; continue; } if (num < 2 && list.Count > 0) { int index2 = Random.Range(0, list.Count); __result.Add(((Il2CppObjectBase)list[index2]).Cast<IUpgradable>()); list.RemoveAt(index2); num++; continue; } if (list2.Count > 0) { int index3 = Random.Range(0, list2.Count); __result.Add(((Il2CppObjectBase)list2[index3]).Cast<IUpgradable>()); list2.RemoveAt(index3); num2++; continue; } if (list.Count <= 0) { break; } int index4 = Random.Range(0, list.Count); __result.Add(((Il2CppObjectBase)list[index4]).Cast<IUpgradable>()); 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<WeaponData>() : null) != (Object)null) { num++; continue; } IUpgradable obj6 = __result[n]; if ((Object)(object)((obj6 != null) ? ((Il2CppObjectBase)obj6).TryCast<TomeData>() : 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<WeaponData>() : null) != (Object)null) { int index5 = Random.Range(0, list2.Count); __result[num3] = ((Il2CppObjectBase)list2[index5]).Cast<IUpgradable>(); 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<TomeData>() : null) != (Object)null) { int index6 = Random.Range(0, list.Count); __result[num4] = ((Il2CppObjectBase)list[index6]).Cast<IUpgradable>(); 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<IntPtr> OurShrines = new HashSet<IntPtr>(); private static InteractableShrineBalance _lastInteracted = null; private static int _interactCount; private static MyPlayer _lastPlayer = null; private static readonly Dictionary<int, EStat> ForcedStats = new Dictionary<int, EStat> { { 1, (EStat)0 }, { 4, (EStat)32 } }; [HarmonyPatch(typeof(SpawnInteractables), "SpawnShrines")] [HarmonyPrefix] private static void SpawnShrines_Prefix() { if (!Plugin.IsEnabled<BaldForestFeature>()) { 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<GameObject>)(object)val2.shrines).Length; j++) { GameObject val3 = ((Il2CppArrayBase<GameObject>)(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<BaldForestFeature>()) { return; } MapData currentMap = MapController.currentMap; if ((Object)(object)currentMap == (Object)null || (int)currentMap.eMap != 1 || (Object)(object)_balancePrefab == (Object)null) { return; } Il2CppArrayBase<BaseInteractable> val = Object.FindObjectsOfType<BaseInteractable>(); List<Vector3> list = new List<Vector3>(); 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<GameObject>(_balancePrefab, val6, _balancePrefab.transform.rotation); if ((Object)(object)val2 != (Object)null) { val8.transform.SetParent(val2); } InteractableShrineBalance component = val8.GetComponent<InteractableShrineBalance>(); 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<BaldForestFeature>()) { 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<EncounterOffer> __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<BaldForestFeature>() || __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<EffectStat>)(object)val.effects).Length; i++) { EffectStat val2 = ((Il2CppArrayBase<EffectStat>)(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<EffectStat>)(object)val.effects).Length; j++) { EffectStat val4 = ((Il2CppArrayBase<EffectStat>)(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<int> 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<int>(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_00