Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ModsUp v1.0.3
Zichen-ModsUp-1.0.3.dll
Decompiled 18 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("Zichen-ModsUp-1.0.3")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+0e34ab30fc314ac0ab0838cdafb5851a7baf4560")] [assembly: AssemblyProduct("Zichen-ModsUp-1.0.3")] [assembly: AssemblyTitle("Zichen-ModsUp-1.0.3")] [assembly: AssemblyVersion("1.0.0.0")] [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; } } } [BepInPlugin("zichen.modsup", "A.ModsUp", "1.0.3")] public sealed class ModsUpPlugin : BaseUnityPlugin { [CompilerGenerated] private sealed class <ScanLoop>d__47 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private WaitForSeconds <waitInit>5__2; private WaitForSeconds <waitScan>5__3; private FieldInfo <ef>5__4; private FieldInfo <sf>5__5; private FieldInfo <df>5__6; private FieldInfo <mf>5__7; private Sprite <sq>5__8; private Sprite <ci>5__9; private Sprite <tr>5__10; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ScanLoop>d__47(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <waitInit>5__2 = null; <waitScan>5__3 = null; <ef>5__4 = null; <sf>5__5 = null; <df>5__6 = null; <mf>5__7 = null; <sq>5__8 = null; <ci>5__9 = null; <tr>5__10 = null; <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <waitInit>5__2 = new WaitForSeconds(1f); <waitScan>5__3 = new WaitForSeconds(0.5f); goto IL_0060; case 1: <>1__state = -1; goto IL_0060; case 2: { <>1__state = -1; if (!IsStaticModEnabled() || (Object)(object)EnemyDirector.instance == (Object)null) { break; } List<EnemyParent> enemiesSpawned = EnemyDirector.instance.enemiesSpawned; if (enemiesSpawned == null || enemiesSpawned.Count == 0) { break; } foreach (EnemyParent item in enemiesSpawned) { try { if ((Object)(object)item == (Object)null || (Object)(object)item.EnableObject == (Object)null) { continue; } object? value = <ef>5__4.GetValue(item); Enemy val = (Enemy)((value is Enemy) ? value : null); if ((Object)(object)val == (Object)null) { continue; } GameObject gameObject = ((Component)val).gameObject; if ((Object)(object)gameObject == (Object)null) { continue; } bool flag = (bool)<sf>5__5.GetValue(item); bool activeSelf = item.EnableObject.activeSelf; MapCustom component = gameObject.GetComponent<MapCustom>(); if (flag && activeSelf && (Object)(object)component == (Object)null) { component = gameObject.AddComponent<MapCustom>(); component.sprite = (Sprite)((int)<df>5__6.GetValue(item) switch { 2 => <tr>5__10, 1 => <ci>5__9, _ => <sq>5__8, }); component.color = Color.red; } else { if ((flag && activeSelf) || !((Object)(object)component != (Object)null)) { continue; } if (<mf>5__7 != null) { object? value2 = <mf>5__7.GetValue(component); Component val2 = (Component)((value2 is Component) ? value2 : null); if (val2 != null) { Object.Destroy((Object)(object)val2.gameObject); } } Object.Destroy((Object)(object)component); continue; } } catch { } } break; } IL_0060: if ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { <>2__current = <waitInit>5__2; <>1__state = 1; return true; } <ef>5__4 = typeof(EnemyParent).GetField("Enemy", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); <sf>5__5 = typeof(EnemyParent).GetField("Spawned", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); <df>5__6 = typeof(EnemyParent).GetField("difficulty", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); <mf>5__7 = typeof(MapCustom).GetField("mapCustomEntity", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); <sq>5__8 = MakeSpr(5, (int _, int _) => true); <ci>5__9 = MakeSpr(10, delegate(int x, int y) { float num4 = 4.5f; return ((float)x - num4) * ((float)x - num4) + ((float)y - num4) * ((float)y - num4) <= 16f; }); <tr>5__10 = MakeSpr(10, delegate(int x, int y) { float num = (x - 1) * 8 - 4 * (y - 1); float num2 = (x - 7) * -8 - 7 * (y - 1); float num3 = -(-4 * (y - 9)); return (!(num < 0f) && !(num2 < 0f) && !(num3 < 0f)) || (!(num > 0f) && !(num2 > 0f) && !(num3 > 0f)); }); break; } <>2__current = <waitScan>5__3; <>1__state = 2; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForMenuAndShowPopup>d__58 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ModsUpPlugin <>4__this; private float <t>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForMenuAndShowPopup>d__58(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ModsUpPlugin modsUpPlugin = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <t>5__2 = 30f; break; case 1: <>1__state = -1; <t>5__2 -= 0.2f; break; } if ((Object)(object)MenuManager.instance == (Object)null && <t>5__2 > 0f) { <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; } if ((Object)(object)MenuManager.instance == (Object)null || showStartupPopup == null || !showStartupPopup.Value) { return false; } (string, string, string, string)[] array = new(string, string, string, string)[3] { ("BetterMap", modsUpPlugin.betterMapResult, "修复 v0.4x 怪物不刷新", "Fixed monster not refreshing in v0.4x"), ("AntiTumble Cooldown", modsUpPlugin.antiTumbleResult, "完全禁用原模组,由 ModsUp 接管即时起身功能", "Fully disables original mod, ModsUp takes over instant tumble exit"), ("MoreInventorySlots", modsUpPlugin.moreInventorySlotsResult, "修复 v0.4x ILHook 失效导致扩展槽位不可用", "Fixed broken ILHook causing extra inventory slots to not work in v0.4x") }; bool flag = false; (string, string, string, string)[] array2 = array; for (int i = 0; i < array2.Length; i++) { if (array2[i].Item2 != null) { flag = true; break; } } if (!flag) { return false; } string text = "ModsUp v1.0.3\n\n"; array2 = array; for (int i = 0; i < array2.Length; i++) { var (text2, text3, text4, text5) = array2[i]; if (text3 != null) { bool flag2 = text3 == "修复已应用"; text += (flag2 ? ("[O] " + text2 + " - " + text4 + "\n") : ("[X] " + text2 + " - " + text3 + "\n")); if (flag2) { text = text + " " + text5 + "\n"; } } } text += "\n此提示仅弹出一次。修改开关需重启游戏。\nThis popup only appears once."; Color val = ((modsUpPlugin.betterMapResult == "修复已应用" || modsUpPlugin.antiTumbleResult == "修复已应用" || (modsUpPlugin.moreInventorySlotsResult != null && modsUpPlugin.moreInventorySlotsResult.StartsWith("修复已应用"))) ? Color.green : Color.yellow); MenuManager.instance.PagePopUpScheduled("ModsUp v1.0.3", val, text, "确认", false); showStartupPopup.Value = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string PluginGuid = "zichen.modsup"; public const string PluginName = "A.ModsUp"; public const string PluginVersion = "1.0.3"; private const string InfoSection = "模组信息"; private const string GlobalSection = "A.全局设置"; private const string BetterMapFixSection = "B.BetterMap v1.0.5 修复"; private const string AntiTumbleFixSection = "C.AntiTumble Cooldown v1.1.1 修复"; private const string MoreInventorySlotsFixSection = "E.MoreInventorySlots v1.0.3 修复"; private const string BetterMapTargetVersion = "1.0.5"; private const string BetterMapTargetGuid = "BetterMap"; private const string AntiTumbleTargetVersion = "1.1.1"; private const string AntiTumbleTargetGuid = "com.yourname.antitumble"; private const string MoreInventorySlotsTargetVersion = "1.0.3"; private const string MoreInventorySlotsTargetGuid = "nickklmao.moreinventoryslots"; private static ConfigEntry<bool> modEnabled; private static ConfigEntry<bool> fixBetterMapEnemyRefresh; private static ConfigEntry<bool> fixAntiTumbleCooldown; private static ConfigEntry<bool> fixMoreInventorySlots; private static ConfigEntry<bool> showStartupPopup; private ConfigEntry<string> moduleNameInfo; private ConfigEntry<string> moduleVersionInfo; private ConfigEntry<string> contactInfo; private Harmony harmony; private string betterMapResult; private string antiTumbleResult; private string moreInventorySlotsResult; private bool antiTumbleActive; private float _atThrottle; private static FieldInfo _atTumbleOverrideTimerField; private static FieldInfo _atTumbleInputTimerField; private static FieldInfo _atPlayerTumbleField; private static FieldInfo _atIsTumblingField; private static FieldInfo _atOverrideSpecialPowersTimerField; private static bool _misActive; private static int _misTargetSlots; private static bool _misHostProtection; private static FieldInfo _misInventorySpotsField; private static MethodInfo _misHandleInputMethod; private static FieldInfo _misAllChildrenField; public static ModsUpPlugin Instance { get; private set; } private void Awake() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown DetachFromManager(); Instance = this; ResetConfigIfVersionChanged(); BindConfig(); harmony = new Harmony("zichen.modsup.patch"); if (IsModEnabled()) { TryFixBetterMap(); TryFixAntiTumble(); TryFixMoreInventorySlots(); ((MonoBehaviour)this).StartCoroutine(WaitForMenuAndShowPopup()); } } private void DetachFromManager() { ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } harmony = null; if (Instance == this) { Instance = null; } } private void TryFixBetterMap() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown if (!fixBetterMapEnemyRefresh.Value) { betterMapResult = "修复已关闭"; return; } if (!CheckPluginVersion("BetterMap", "1.0.5", out var detected)) { betterMapResult = (string.IsNullOrEmpty(detected) ? "未检测到 BetterMap" : ("版本不匹配(需 1.0.5,当前 " + detected + ")")); return; } try { Harmony val = new Harmony("BetterMap"); (Type, string)[] array = new(Type, string)[5] { (typeof(EnemyParent), "SpawnRPC"), (typeof(EnemyParent), "DespawnRPC"), (typeof(LevelGenerator), "GenerateDone"), (typeof(PlayerAvatar), "ReviveRPC"), (typeof(PlayerAvatar), "PlayerDeathRPC") }; for (int i = 0; i < array.Length; i++) { (Type, string) tuple = array[i]; Type item = tuple.Item1; string item2 = tuple.Item2; MethodInfo methodInfo = AccessTools.Method(item, item2, (Type[])null, (Type[])null); if (methodInfo != null) { val.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)0, "BetterMap"); } } ((MonoBehaviour)this).StartCoroutine(ScanLoop()); betterMapResult = "修复已应用"; } catch (Exception ex) { betterMapResult = "修复失败: " + ex.Message; } } [IteratorStateMachine(typeof(<ScanLoop>d__47))] private static IEnumerator ScanLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ScanLoop>d__47(0); } private static Sprite MakeSpr(int s, Func<int, int, bool> fn) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0068: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(s, s, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[s * s]; for (int i = 0; i < s; i++) { for (int j = 0; j < s; j++) { array[i * s + j] = (fn(j, i) ? Color.white : Color.clear); } } val.SetPixels(array); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)s, (float)s), new Vector2(0.5f, 0.5f)); } private void TryFixAntiTumble() { if (!fixAntiTumbleCooldown.Value) { antiTumbleResult = "修复已关闭"; return; } if (!CheckPluginVersion("com.yourname.antitumble", "1.1.1", out var detected)) { antiTumbleResult = (string.IsNullOrEmpty(detected) ? "未检测到 AntiTumble Cooldown" : ("版本不匹配(需 1.1.1,当前 " + detected + ")")); return; } try { Type type = typeof(PlayerController).Assembly.GetType("PlayerTumble"); foreach (PluginInfo value in Chainloader.PluginInfos.Values) { if (value.Metadata.GUID != "com.yourname.antitumble") { continue; } BaseUnityPlugin instance = value.Instance; if ((Object)(object)instance == (Object)null) { break; } FieldInfo field = ((object)instance).GetType().GetField("tumblingField", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && (!(field.GetValue(instance) is FieldInfo fieldInfo) || !(fieldInfo.Name == "isTumbling"))) { FieldInfo fieldInfo2 = type?.GetField("isTumbling", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (fieldInfo2 != null) { field.SetValue(instance, fieldInfo2); } } ((Behaviour)instance).enabled = false; Harmony.UnpatchID("com.yourname.antitumble"); break; } if (type != null) { _atTumbleOverrideTimerField = type.GetField("tumbleOverrideTimer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } _atTumbleInputTimerField = typeof(PlayerController).GetField("tumbleInputDisableTimer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); _atPlayerTumbleField = typeof(PlayerAvatar).GetField("tumble", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); _atIsTumblingField = typeof(PlayerAvatar).GetField("isTumbling", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); _atOverrideSpecialPowersTimerField = typeof(PhysGrabber).GetField("overrideDisableSpecialGrabPowersTimer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); antiTumbleActive = true; antiTumbleResult = "修复已应用"; } catch (Exception ex) { antiTumbleResult = "修复失败: " + ex.Message; } } private void TryFixMoreInventorySlots() { //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown if (!fixMoreInventorySlots.Value) { moreInventorySlotsResult = "修复已关闭"; return; } if (!CheckPluginVersion("nickklmao.moreinventoryslots", "1.0.3", out var detected)) { moreInventorySlotsResult = (string.IsNullOrEmpty(detected) ? "未检测到 MoreInventorySlots" : ("版本不匹配(需 1.0.3,当前 " + detected + ")")); return; } try { ReadMoreInventorySlotsConfig(out var slots, out var hostProtection); _misTargetSlots = slots; _misHostProtection = hostProtection; if (_misTargetSlots <= 3) { moreInventorySlotsResult = "槽位数 ≤ 3,无需修复"; return; } _misInventorySpotsField = typeof(Inventory).GetField("inventorySpots", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); _misAllChildrenField = typeof(SemiUI).GetField("allChildren", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); _misHandleInputMethod = typeof(InventorySpot).GetMethod("HandleInput", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (_misInventorySpotsField == null || _misHandleInputMethod == null) { moreInventorySlotsResult = "修复失败: 反射字段未找到"; return; } foreach (PluginInfo value in Chainloader.PluginInfos.Values) { if (!(value.Metadata.GUID != "nickklmao.moreinventoryslots")) { if ((Object)(object)value.Instance != (Object)null) { ((Behaviour)value.Instance).enabled = false; } break; } } MethodInfo method = typeof(Inventory).GetMethod("Awake", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { harmony.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(typeof(ModsUpPlugin), "MISInventoryAwakePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo method2 = typeof(Inventory).GetMethod("InventorySpotAddAtIndex", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method2 != null) { harmony.Patch((MethodBase)method2, new HarmonyMethod(typeof(ModsUpPlugin), "MISSlotAddPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo method3 = typeof(InventoryUI).GetMethod("Start", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method3 != null) { harmony.Patch((MethodBase)method3, (HarmonyMethod)null, new HarmonyMethod(typeof(ModsUpPlugin), "MISInventoryUIStartPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo method4 = typeof(ItemEquippable).GetMethod("RPC_RequestEquip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method4 != null) { harmony.Patch((MethodBase)method4, new HarmonyMethod(typeof(ModsUpPlugin), "MISRequestEquipPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } _misActive = true; moreInventorySlotsResult = $"修复已应用({_misTargetSlots} 槽位)"; } catch (Exception ex) { moreInventorySlotsResult = "修复失败: " + ex.Message; } } private static void MISInventoryAwakePostfix(Inventory __instance) { if (_misTargetSlots > 3 && !((Object)(object)Inventory.instance != (Object)(object)__instance) && _misInventorySpotsField.GetValue(__instance) is IList list) { while (list.Count < _misTargetSlots) { list.Add(null); } } } private static void MISSlotAddPrefix(Inventory __instance, int index) { if (index >= 3 && _misTargetSlots > 3 && _misInventorySpotsField?.GetValue(__instance) is IList list) { while (list.Count <= index) { list.Add(null); } } } private static void MISInventoryUIStartPostfix(InventoryUI __instance) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) if (_misTargetSlots <= 3 || (Object)(object)__instance == (Object)null) { return; } List<GameObject> list = null; if (_misAllChildrenField != null) { list = _misAllChildrenField.GetValue(__instance) as List<GameObject>; } Transform transform = ((Component)__instance).transform; float num = (float)(-(_misTargetSlots * 40)) / 2f + 20f; for (int i = 0; i < 3; i++) { Transform val = transform.Find($"Inventory Spot {i + 1}"); if ((Object)(object)val != (Object)null) { val.localPosition = new Vector3(num + (float)i * 40f, -175.3f, 0f); } } Transform child = transform.GetChild(0); if ((Object)(object)child == (Object)null) { return; } for (int j = 3; j < _misTargetSlots; j++) { string text = $"Inventory Spot {j + 1}"; Transform val2 = transform.Find(text); if ((Object)(object)val2 != (Object)null) { val2.localPosition = new Vector3(num + (float)j * 40f, -175.3f, 0f); InventorySpot component = ((Component)val2).GetComponent<InventorySpot>(); if ((Object)(object)component != (Object)null) { component.inventorySpotIndex = j; } continue; } Transform val3 = Object.Instantiate<Transform>(child, child.parent); ((Object)val3).name = text; InventorySpot component2 = ((Component)val3).GetComponent<InventorySpot>(); if ((Object)(object)component2 != (Object)null) { component2.inventorySpotIndex = j; } if ((Object)(object)component2 != (Object)null && (Object)(object)component2.noItem != (Object)null) { ((TMP_Text)component2.noItem).text = (j + 1).ToString(); } Transform val4 = val3.Find("Numbers"); if ((Object)(object)val4 != (Object)null) { TextMeshProUGUI component3 = ((Component)val4).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component3 != (Object)null) { ((TMP_Text)component3).text = (j + 1).ToString(); } } val3.localPosition = new Vector3(num + (float)j * 40f, -175.3f, 0f); if (list != null && !list.Contains(((Component)val3).gameObject)) { list.Add(((Component)val3).gameObject); } } } private static bool MISRequestEquipPrefix(int spotIndex) { if (!_misActive || !_misHostProtection) { return true; } if (!SemiFunc.IsMultiplayer()) { return true; } if (spotIndex < _misTargetSlots) { return true; } return false; } private void ReadMoreInventorySlotsConfig(out int slots, out bool hostProtection) { slots = 3; hostProtection = true; try { string path = Path.Combine(Paths.ConfigPath, "nickklmao.moreinventoryslots.cfg"); if (File.Exists(path)) { string input = File.ReadAllText(path); Match match = Regex.Match(input, "(?m)^Number\\s+Of\\s+Slots\\s*=\\s*(\\d+)"); if (match.Success && int.TryParse(match.Groups[1].Value, out var result)) { slots = result; } Match match2 = Regex.Match(input, "(?m)^Host\\s+Protection\\s*=\\s*(true|false)", RegexOptions.IgnoreCase); if (match2.Success && bool.TryParse(match2.Groups[1].Value, out var result2)) { hostProtection = result2; } } } catch { } } private void HandleMoreInventorySlotsInput() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (!_misActive || _misTargetSlots <= 3 || (Object)(object)Inventory.instance == (Object)null || (Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated || Keyboard.current == null || !(_misInventorySpotsField.GetValue(Inventory.instance) is IList list)) { return; } for (int i = 3; i < _misTargetSlots && i < list.Count; i++) { Key val = (Key)((i == 9) ? 50 : (41 + i)); if (((ButtonControl)Keyboard.current[val]).wasPressedThisFrame) { object? obj = list[i]; InventorySpot val2 = (InventorySpot)((obj is InventorySpot) ? obj : null); if ((Object)(object)val2 != (Object)null) { _misHandleInputMethod.Invoke(val2, null); } } } } private static bool CheckPluginVersion(string guid, string expected, out string detected) { detected = null; foreach (PluginInfo value in Chainloader.PluginInfos.Values) { if (value.Metadata.GUID == guid) { detected = value.Metadata.Version.ToString(); return detected == expected; } } return false; } [IteratorStateMachine(typeof(<WaitForMenuAndShowPopup>d__58))] private IEnumerator WaitForMenuAndShowPopup() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForMenuAndShowPopup>d__58(0) { <>4__this = this }; } private void Update() { if (!IsModEnabled() || (!antiTumbleActive && !_misActive)) { return; } if (antiTumbleActive && !(Time.time - _atThrottle < 0.25f)) { _atThrottle = Time.time; PlayerController instance = PlayerController.instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)LevelGenerator.Instance == (Object)null) && LevelGenerator.Instance.Generated) { PlayerAvatar playerAvatarScript = instance.playerAvatarScript; if (!((Object)(object)playerAvatarScript == (Object)null)) { object obj = _atPlayerTumbleField?.GetValue(playerAvatarScript); if (obj != null) { _atTumbleOverrideTimerField?.SetValue(obj, 0f); _atTumbleInputTimerField?.SetValue(instance, 0f); if ((!(_atIsTumblingField != null) || !(bool)_atIsTumblingField.GetValue(playerAvatarScript)) && (Object)(object)playerAvatarScript.physGrabber != (Object)null && _atOverrideSpecialPowersTimerField != null) { _atOverrideSpecialPowersTimerField.SetValue(playerAvatarScript.physGrabber, 0f); } } } } } HandleMoreInventorySlotsInput(); } private bool IsModEnabled() { if (modEnabled != null) { return modEnabled.Value; } return false; } public static bool IsStaticModEnabled() { if ((Object)(object)Instance != (Object)null) { return Instance.IsModEnabled(); } return false; } private void BindConfig() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Expected O, but got Unknown //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Expected O, but got Unknown moduleNameInfo = ((BaseUnityPlugin)this).Config.Bind<string>("模组信息", "模组名称", "模组批量修复", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 1000, CustomDrawer = DrawInfo, ReadOnly = true } })); moduleNameInfo.Value = "模组批量修复"; moduleVersionInfo = ((BaseUnityPlugin)this).Config.Bind<string>("模组信息", "模组版本号", "1.0.3", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 990, CustomDrawer = DrawInfo, ReadOnly = true } })); moduleVersionInfo.Value = "1.0.3"; contactInfo = ((BaseUnityPlugin)this).Config.Bind<string>("模组信息", "REPO交流QQ群", "824639225", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 980, CustomDrawer = DrawInfo, ReadOnly = true } })); contactInfo.Value = "824639225"; modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("A.全局设置", "模组启用", true, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 1000 } })); showStartupPopup = ((BaseUnityPlugin)this).Config.Bind<bool>("A.全局设置", "启动提示", true, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 890 } })); fixBetterMapEnemyRefresh = ((BaseUnityPlugin)this).Config.Bind<bool>("B.BetterMap v1.0.5 修复", "修复怪物刷新", true, new ConfigDescription("需要 BetterMap v1.0.5。开关修改后需重启游戏。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 900 } })); fixAntiTumbleCooldown = ((BaseUnityPlugin)this).Config.Bind<bool>("C.AntiTumble Cooldown v1.1.1 修复", "修复翻滚冷却", true, new ConfigDescription("需要 AntiTumble Cooldown v1.1.1。完全禁用原模组,由 ModsUp 接管全部功能。开关修改后需重启游戏。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 900 } })); fixMoreInventorySlots = ((BaseUnityPlugin)this).Config.Bind<bool>("E.MoreInventorySlots v1.0.3 修复", "修复扩展背包", true, new ConfigDescription("需要 MoreInventorySlots v1.0.3。开关修改后需重启游戏。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 900 } })); } private void ResetConfigIfVersionChanged() { try { string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; string text = ReadModVersion(configFilePath); if (!string.IsNullOrWhiteSpace(text) && !(text == "1.0.3")) { ((BaseUnityPlugin)this).Config.Clear(); if (File.Exists(configFilePath)) { File.Delete(configFilePath); } ((BaseUnityPlugin)this).Config.Reload(); } } catch { } } private static string ReadModVersion(string path) { if (!File.Exists(path)) { return null; } Match match = Regex.Match(File.ReadAllText(path), "(?m)^模组版本号\\s*=\\s*(.+?)\\s*$"); if (!match.Success) { return null; } return match.Groups[1].Value.Trim(); } private static void DrawInfo(ConfigEntryBase e) { GUILayout.Label(e.BoxedValue?.ToString() ?? "", Array.Empty<GUILayoutOption>()); } } internal sealed class ConfigurationManagerAttributes { public bool? ShowRangeAsPercent; public Action<ConfigEntryBase> CustomDrawer; public bool? Browsable; public string Category; public object DefaultValue; public bool? HideDefaultButton; public bool? HideSettingName; public string Description; public string DispName; public int? Order; public bool? ReadOnly; public bool? IsAdvanced; }