Decompiled source of BetterCounterOffer v1.1.0

BetterCounterOffer.dll

Decompiled a month ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using Il2CppScheduleOne.ItemFramework;
using Il2CppScheduleOne.Product;
using Il2CppScheduleOne.UI.Phone;
using Il2CppSystem.Collections.Generic;
using MelonLoader;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(BetterCounterOffer), "Better Counter Offer", "1.1.0", "OverweightUnicorn", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: AssemblyTitle("BetterCounterOffer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterCounterOffer")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a95b1039-39fb-4af3-adf5-38686a9eb940")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
public class BetterCounterOffer : MelonMod
{
	[HarmonyPatch(typeof(CounterOfferProductSelector), "GetMatchingProducts")]
	private static class CounterOfferProductSelectorGetMatchingProductsPatch
	{
		public static void Postfix(CounterofferInterface __instance, ref List<ProductDefinition> __result, ref string searchTerm)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			HashSet<EDrugType> hashSet = new HashSet<EDrugType>();
			List<ProductDefinition> listedProducts = ProductManager.ListedProducts;
			List<ProductDefinition> val = new List<ProductDefinition>();
			if (searchTerm.ToLower().Contains("weed"))
			{
				hashSet.Add((EDrugType)0);
			}
			if (searchTerm.ToLower().Contains("coke"))
			{
				hashSet.Add((EDrugType)2);
			}
			if (searchTerm.ToLower().Contains("meth"))
			{
				hashSet.Add((EDrugType)1);
			}
			Enumerator<ProductDefinition> enumerator = listedProducts.GetEnumerator();
			while (enumerator.MoveNext())
			{
				ProductDefinition current = enumerator.Current;
				if (hashSet.Contains(current.DrugType) || ((ItemDefinition)current).Name.ToLower().Contains(searchTerm))
				{
					val.Add(current);
				}
			}
			__result = val;
		}
	}

	[HarmonyPatch(typeof(CounterofferInterface), "UpdateFairPrice")]
	private static class CounterOfferUpdateFairPricePatch
	{
		public static bool Prefix(CounterofferInterface __instance)
		{
			ProductDefinition selectedProduct = __instance.selectedProduct;
			float num = (float)__instance.quantity * selectedProduct.Price - __instance.price;
			__instance.ChangePrice(num);
			return true;
		}
	}

	public override void OnInitializeMelon()
	{
		MelonLogger.Msg("Initializing Better Counter Offer...Go Make that Money");
		MelonLogger.Msg("If you find any bugs message me on nexus - OverweightUnicorn");
	}
}