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 MoreItems v1.1.0
MoreItems.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MoreItems")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MoreItems")] [assembly: AssemblyTitle("MoreItems")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace MoItems { [BepInPlugin("me.brunson.MoreItems", "MoreItems", "1.1.0")] public class MoreItems : BaseUnityPlugin { [HarmonyPatch] public class SetupHostMoveNextPatch { [HarmonyTargetMethod] public static MethodBase TargetMethod() { Type type = AccessTools.FirstInner(typeof(ValuableDirector), (Func<Type, bool>)((Type t) => t.Name.Contains("SetupHost"))); if (type != null) { MethodInfo method = type.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { Debug.Log((object)"Target method found: MoveNext()"); return method; } method = type.GetMethods().FirstOrDefault((MethodInfo m) => m.ReturnType == typeof(bool) && m.GetParameters().Length == 0); if (method != null) { Debug.Log((object)("Fallback method found: " + method.Name)); return method; } } throw new Exception("Could not find MoveNext or any valid method in <SetupHost>d__59!"); } [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Expected O, but got Unknown //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Expected O, but got Unknown //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); List<OpCode> list2 = new List<OpCode> { OpCodes.Ldloc_1, OpCodes.Ldloc_1, OpCodes.Ldfld, OpCodes.Ldloc_2, OpCodes.Callvirt, OpCodes.Call, OpCodes.Stfld }; for (int i = 0; i < list.Count - list2.Count; i++) { bool flag = true; for (int j = 0; j < list2.Count; j++) { if (list[i + j].opcode != list2[j]) { flag = false; break; } } if (flag && list[i + 6].operand != null && list[i + 6].operand.ToString().Contains("veryTallMaxAmount")) { Debug.Log((object)$"Found target pattern at index {i + 6}"); string[] array = new string[8] { "totalMaxAmount", "tinyMaxAmount", "smallMaxAmount", "mediumMaxAmount", "bigMaxAmount", "wideMaxAmount", "tallMaxAmount", "veryTallMaxAmount" }; for (int k = 0; k < array.Length; k++) { FieldInfo fieldInfo = AccessTools.Field(typeof(ValuableDirector), array[k]); list.Insert(i + 7 + k * 14, new CodeInstruction(OpCodes.Ldloc_1, (object)null)); list.Insert(i + 8 + k * 14, new CodeInstruction(OpCodes.Dup, (object)null)); list.Insert(i + 9 + k * 14, new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo)); list.Insert(i + 10 + k * 14, new CodeInstruction(OpCodes.Box, (object)typeof(int))); list.Insert(i + 11 + k * 14, new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Debug), "Log", new Type[1] { typeof(object) }, (Type[])null))); list.Insert(i + 12 + k * 14, new CodeInstruction(OpCodes.Ldloc_1, (object)null)); list.Insert(i + 13 + k * 14, new CodeInstruction(OpCodes.Dup, (object)null)); list.Insert(i + 14 + k * 14, new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo)); list.Insert(i + 15 + k * 14, new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(PlayerCountModifier), "AddPlayerCountToTotal", (Type[])null, (Type[])null))); list.Insert(i + 16 + k * 14, new CodeInstruction(OpCodes.Stfld, (object)fieldInfo)); list.Insert(i + 17 + k * 14, new CodeInstruction(OpCodes.Ldloc_1, (object)null)); list.Insert(i + 18 + k * 14, new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo)); list.Insert(i + 19 + k * 14, new CodeInstruction(OpCodes.Box, (object)typeof(int))); list.Insert(i + 20 + k * 14, new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Debug), "Log", new Type[1] { typeof(object) }, (Type[])null))); } break; } } return list.AsEnumerable(); } } public static class PlayerCountModifier { public static int AddPlayerCountToTotal(ValuableDirector instance, int original) { int count = SemiFunc.PlayerGetAll().Count; if (count < minPlayersConfig.Value) { return original; } return (int)Math.Ceiling((float)original * (1f + (float)(count - minPlayersConfig.Value + 1) * percentageConfig.Value)); } } public const string modGUID = "me.brunson.MoreItems"; public const string modName = "MoreItems"; public const string modVersion = "1.1.0"; private readonly Harmony harmony = new Harmony("me.brunson.MoreItems"); internal static ManualLogSource log; private static ConfigEntry<int> minPlayersConfig; private static ConfigEntry<float> percentageConfig; public void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown log = ((BaseUnityPlugin)this).Logger; minPlayersConfig = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MinPlayers", 5, new ConfigDescription("The minimum number of players needed to increase the number of valuables. (1 = works in singleplayer)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 8), Array.Empty<object>())); percentageConfig = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Percentage", 0.2f, new ConfigDescription("The percentage to increase items by per player. (0 = default settings, 1 = double items)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreItems loaded"); } } }