Decompiled source of DeliveryFix v1.0.0

DeliveryFix_Il2cpp.dll

Decompiled 2 days ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using DeliveryFix;
using HarmonyLib;
using Il2CppScheduleOne.Property;
using Il2CppScheduleOne.UI.Phone.Delivery;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using MelonLoader.Preferences;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "DeliveryFix", "1.0.0", "HazDS", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DeliveryFix")]
[assembly: AssemblyConfiguration("Il2cpp")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DeliveryFix")]
[assembly: AssemblyTitle("DeliveryFix")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DeliveryFix
{
	public class Core : MelonMod
	{
		private static MelonPreferences_Category _config;

		private static readonly Dictionary<string, MelonPreferences_Entry<bool>> _propertyEntries = new Dictionary<string, MelonPreferences_Entry<bool>>();

		public static Core Instance { get; private set; }

		public override void OnInitializeMelon()
		{
			Instance = this;
			_config = MelonPreferences.CreateCategory("DeliveryFix", "Delivery Fix");
			CreateEntry("RV", defaultValue: false);
			CreateEntry("Barn", defaultValue: true);
			CreateEntry("Bungalow", defaultValue: true);
			CreateEntry("Docks Warehouse", defaultValue: true);
			CreateEntry("Hyland Manor", defaultValue: true);
			CreateEntry("Motel Room", defaultValue: false);
			CreateEntry("Sewer Office", defaultValue: false);
			CreateEntry("Storage Unit", defaultValue: true);
			CreateEntry("Sweatshop", defaultValue: false);
			CreateEntry("Car Wash", defaultValue: false);
			CreateEntry("Laundromat", defaultValue: false);
			CreateEntry("Post Office", defaultValue: false);
			CreateEntry("Taco Ticklers", defaultValue: false);
			((MelonBase)this).LoggerInstance.Msg("DeliveryFix initialized");
		}

		private void CreateEntry(string propertyName, bool defaultValue)
		{
			string text = propertyName.Replace(" ", "");
			MelonPreferences_Entry<bool> value = _config.CreateEntry<bool>(text, defaultValue, propertyName, (string)null, false, false, (ValueValidator)null, (string)null);
			_propertyEntries[propertyName] = value;
		}

		public static bool IsPropertyEnabled(string propertyName)
		{
			if (_propertyEntries.TryGetValue(propertyName, out var value))
			{
				return value.Value;
			}
			return true;
		}
	}
}
namespace DeliveryFix.Patches
{
	[HarmonyPatch(typeof(DeliveryShop), "GetPotentialDestinations")]
	public static class DeliveryShop_GetPotentialDestinations_Patch
	{
		[HarmonyPostfix]
		public static void Postfix(ref List<Property> __result)
		{
			if (__result == null || __result.Count == 0)
			{
				return;
			}
			for (int num = __result.Count - 1; num >= 0; num--)
			{
				if (!Core.IsPropertyEnabled(__result[num].PropertyName))
				{
					__result.RemoveAt(num);
				}
			}
		}
	}
}

DeliveryFix_Mono.dll

Decompiled 2 days ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using DeliveryFix;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Preferences;
using ScheduleOne.Property;
using ScheduleOne.UI.Phone.Delivery;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "DeliveryFix", "1.0.0", "HazDS", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DeliveryFix")]
[assembly: AssemblyConfiguration("Mono")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DeliveryFix")]
[assembly: AssemblyTitle("DeliveryFix")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DeliveryFix
{
	public class Core : MelonMod
	{
		private static MelonPreferences_Category _config;

		private static readonly Dictionary<string, MelonPreferences_Entry<bool>> _propertyEntries = new Dictionary<string, MelonPreferences_Entry<bool>>();

		public static Core Instance { get; private set; }

		public override void OnInitializeMelon()
		{
			Instance = this;
			_config = MelonPreferences.CreateCategory("DeliveryFix", "Delivery Fix");
			CreateEntry("RV", defaultValue: false);
			CreateEntry("Barn", defaultValue: true);
			CreateEntry("Bungalow", defaultValue: true);
			CreateEntry("Docks Warehouse", defaultValue: true);
			CreateEntry("Hyland Manor", defaultValue: true);
			CreateEntry("Motel Room", defaultValue: false);
			CreateEntry("Sewer Office", defaultValue: false);
			CreateEntry("Storage Unit", defaultValue: true);
			CreateEntry("Sweatshop", defaultValue: false);
			CreateEntry("Car Wash", defaultValue: false);
			CreateEntry("Laundromat", defaultValue: false);
			CreateEntry("Post Office", defaultValue: false);
			CreateEntry("Taco Ticklers", defaultValue: false);
			((MelonBase)this).LoggerInstance.Msg("DeliveryFix initialized");
		}

		private void CreateEntry(string propertyName, bool defaultValue)
		{
			string text = propertyName.Replace(" ", "");
			MelonPreferences_Entry<bool> value = _config.CreateEntry<bool>(text, defaultValue, propertyName, (string)null, false, false, (ValueValidator)null, (string)null);
			_propertyEntries[propertyName] = value;
		}

		public static bool IsPropertyEnabled(string propertyName)
		{
			if (_propertyEntries.TryGetValue(propertyName, out var value))
			{
				return value.Value;
			}
			return true;
		}
	}
}
namespace DeliveryFix.Patches
{
	[HarmonyPatch(typeof(DeliveryShop), "GetPotentialDestinations")]
	public static class DeliveryShop_GetPotentialDestinations_Patch
	{
		[HarmonyPostfix]
		public static void Postfix(ref List<Property> __result)
		{
			if (__result == null || __result.Count == 0)
			{
				return;
			}
			for (int num = __result.Count - 1; num >= 0; num--)
			{
				if (!Core.IsPropertyEnabled(__result[num].PropertyName))
				{
					__result.RemoveAt(num);
				}
			}
		}
	}
}