Decompiled source of UnlimitedItemsMod v1.0.0

UnlimitedItems.dll

Decompiled 3 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ClassLibrary1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("57251da7-dddf-47d7-8ec9-cdc78fec28c7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.yourname.unlimiteditems", "Unlimited Items Mod", "1.1.0")]
public class UnlimitedItemsMod : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		Debug.Log((object)"✅ Unlimited Items Mod Loaded");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"✅ Unlimited Items Mod Loaded");
		Harmony val = new Harmony("com.yourname.unlimiteditems");
		val.PatchAll();
	}
}
[HarmonyPatch(typeof(Terminal), "LoadNewNodeIfAffordable")]
public static class PatchTerminalItemLimit
{
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		for (int i = 0; i < list.Count; i++)
		{
			if (list[i].opcode == OpCodes.Ldc_I4_S && (sbyte)list[i].operand == 12)
			{
				Debug.Log((object)"\ud83d\ude80 Unlimited Items Mod: Removed int limit in LoadNewNodeIfAffordable!");
				list[i].operand = 9999;
			}
			if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 12f)
			{
				Debug.Log((object)"\ud83d\ude80 Unlimited Items Mod: Removed float limit in LoadNewNodeIfAffordable!");
				list[i].operand = 9999f;
			}
		}
		return list;
	}
}
[HarmonyPatch(typeof(Terminal), "SyncBoughtItemsWithServer")]
public static class PatchTerminalClientLimit
{
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		for (int i = 0; i < list.Count; i++)
		{
			if (list[i].opcode == OpCodes.Ldc_I4_S && (sbyte)list[i].operand == 12)
			{
				Debug.Log((object)"\ud83d\ude80 Unlimited Items Mod: nigger!");
				list[i].operand = 9999;
			}
		}
		return list;
	}
}
[HarmonyPatch(typeof(Terminal), "BuyItemsServerRpc")]
public static class PatchTerminalBuyItemsLimit
{
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		for (int i = 0; i < list.Count; i++)
		{
			if (list[i].opcode == OpCodes.Ldc_I4_S && (sbyte)list[i].operand == 12)
			{
				Debug.Log((object)"\ud83d\ude80 Unlimited Items Mod: Removed deex nuts!");
				list[i].operand = 9999;
			}
		}
		return list;
	}
}
[HarmonyPatch(typeof(Terminal), "SyncGroupCreditsClientRpc")]
public static class PatchSyncGroupCreditsClientRpc
{
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		for (int i = 0; i < list.Count; i++)
		{
			if (list[i].opcode == OpCodes.Ldc_I4_S && (sbyte)list[i].operand == 12)
			{
				Debug.Log((object)"\ud83d\ude80 Unlimited Items Mod: Removed balls!");
				list[i].operand = 9999;
			}
		}
		return list;
	}
}
[HarmonyPatch(typeof(ItemDropship), "OpenShipDoorsOnServer")]
public static class PatchDropshipSpawnLogic
{
	private static void Prefix(ItemDropship __instance)
	{
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: 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_0156: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"\ud83d\ude9b Unlimited Items Mod: Adjusting dropship spawn logic for bulk orders.");
		FieldInfo field = typeof(ItemDropship).GetField("itemsToDeliver", BindingFlags.Instance | BindingFlags.NonPublic);
		FieldInfo field2 = typeof(ItemDropship).GetField("playersManager", BindingFlags.Instance | BindingFlags.NonPublic);
		FieldInfo field3 = typeof(ItemDropship).GetField("terminalScript", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field == null || field2 == null || field3 == null)
		{
			Debug.LogError((object)"❌ Unlimited Items Mod: Gooning failed.");
			return;
		}
		List<int> list = field.GetValue(__instance) as List<int>;
		object? value = field2.GetValue(__instance);
		StartOfRound val = (StartOfRound)((value is StartOfRound) ? value : null);
		object? value2 = field3.GetValue(__instance);
		Terminal val2 = (Terminal)((value2 is Terminal) ? value2 : null);
		if (list == null || (Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
		{
			Debug.LogError((object)"❌ Unlimited Items Mod: Levi's balls detected.");
			return;
		}
		int num = 0;
		Transform[] itemSpawnPositions = __instance.itemSpawnPositions;
		foreach (int item in list)
		{
			GameObject spawnPrefab = val2.buyableItemsList[item].spawnPrefab;
			Transform val3 = itemSpawnPositions[num % itemSpawnPositions.Length];
			Vector3 val4 = val3.position + new Vector3(Random.Range(-0.5f, 0.5f), 0f, Random.Range(-0.5f, 0.5f));
			GameObject val5 = Object.Instantiate<GameObject>(spawnPrefab, val4, Quaternion.identity, val.propsContainer);
			val5.GetComponent<GrabbableObject>().fallTime = 0f;
			val5.GetComponent<NetworkObject>().Spawn(false);
			num++;
		}
		list.Clear();
	}
}
[HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")]
public static class PatchTerminalSmartParserCap
{
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		for (int i = 0; i < list.Count; i++)
		{
			if (list[i].opcode == OpCodes.Ldc_I4_S && (sbyte)list[i].operand == 10)
			{
				Debug.Log((object)"\ud83d\ude80 Unlimited Items Mod: We beat thos niggas!");
				list[i].operand = 9999;
			}
		}
		return list;
	}
}
[HarmonyPatch(typeof(Terminal), "LoadCargoOrder")]
public static class PatchTerminalCargoClamp
{
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		for (int i = 0; i < list.Count; i++)
		{
			if (list[i].opcode == OpCodes.Ldc_I4_S && (sbyte)list[i].operand == 15)
			{
				Debug.Log((object)"\ud83d\ude80 Unlimited Items Mod: Removed 15-item cargo clamp in LoadCargoOrder!");
				list[i].operand = 9999;
			}
		}
		return list;
	}
}