using System; using System.Collections; 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 System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using ShipNoLimits.Patches; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: AssemblyCompany("ShipNoLimits")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+4a764036dce782dcccc577a698a4a188cdf4c9ea")] [assembly: AssemblyProduct("Too Many Items")] [assembly: AssemblyTitle("ShipNoLimits")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 ShipNoLimits { [BepInPlugin("custommods.ShipNoLimits", "ShipNoLimits", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class ShipNoLimits : BaseUnityPlugin { public const string GUID = "mattymatty.TooManyItems"; public const string NAME = "TooManyItems"; public const string VERSION = "1.4.1"; internal static ManualLogSource Log; private void Awake() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; try { Log.LogInfo((object)"Patching Methods"); Harmony val = new Harmony("mattymatty.TooManyItems"); val.PatchAll(typeof(LimitPatcher)); Log.LogInfo((object)"TooManyItems v1.4.1 Loaded!"); } catch (Exception ex) { Log.LogError((object)("Exception while initializing: \n" + ex)); } } } } namespace ShipNoLimits.Patches { [HarmonyPatch] internal class LimitPatcher { [HarmonyTranspiler] [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")] private static IEnumerable PacketSizePatch(IEnumerable instructions) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown MethodInfo method = typeof(NetworkBehaviour).GetMethod("__beginSendClientRpc", BindingFlags.Instance | BindingFlags.NonPublic); ConstructorInfo constructor = typeof(FastBufferWriter).GetConstructor(new Type[3] { typeof(int), typeof(Allocator), typeof(int) }); List list = instructions.ToList(); CodeMatcher val = new CodeMatcher((IEnumerable)list, (ILGenerator)null); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)method, (string)null) }); if (val.IsInvalid) { ShipNoLimits.Log.LogWarning((object)"PacketSize patch failed 1!!"); ShipNoLimits.Log.LogDebug((object)string.Join("\n", val.Instructions())); return list; } val.Advance(1); val.Insert((CodeInstruction[])(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Pop, (object)null), new CodeInstruction(OpCodes.Ldc_I4, (object)1024), new CodeInstruction(OpCodes.Ldc_I4_2, (object)null), new CodeInstruction(OpCodes.Ldc_I4, (object)536870912), new CodeInstruction(OpCodes.Newobj, (object)constructor) }); ShipNoLimits.Log.LogDebug((object)"Patched PacketSize!"); return val.Instructions(); } [HarmonyTranspiler] [HarmonyPriority(800)] [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesServerRpc")] private static IEnumerable SyncUnlockablesPatch(IEnumerable instructions) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown MethodInfo method = typeof(GrabbableObject).GetMethod("GetItemDataToSave"); List list = instructions.ToList(); CodeMatcher val = new CodeMatcher((IEnumerable)list, (ILGenerator)null); val.End(); val.MatchBack(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)method, (string)null) }); if (val.IsInvalid) { ShipNoLimits.Log.LogWarning((object)"SyncShipUnlockablesServerRpc patch failed 1!!"); ShipNoLimits.Log.LogDebug((object)string.Join("\n", val.Instructions())); return list; } val.MatchBack(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ble, (object)null, (string)null) }); if (val.IsInvalid) { ShipNoLimits.Log.LogWarning((object)"SyncShipUnlockablesServerRpc patch failed 2!!"); ShipNoLimits.Log.LogDebug((object)string.Join("\n", val.Instructions())); return list; } List