Decompiled source of Schedule2 v1.0.2

Enchanced.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
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 HarmonyLib;
using MelonLoader;
using S2;
using ScheduleOne.Casino;
using ScheduleOne.DevUtilities;
using ScheduleOne.Interaction;
using ScheduleOne.ItemFramework;
using ScheduleOne.Messaging;
using ScheduleOne.NPCs;
using ScheduleOne.ObjectScripts;
using ScheduleOne.PlayerScripts;
using ScheduleOne.Property;
using ScheduleOne.UI.Items;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::S2.S2), "Enchanced-Debug", "1.0", "Estonia", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: AssemblyTitle("StackSizes")]
[assembly: AssemblyDescription("Increases Stack Sizes")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Estonia")]
[assembly: AssemblyProduct("StackSizes")]
[assembly: AssemblyCopyright("Copyright © Estonia 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3506c5d7-811e-4046-9fe7-9e963df141bd")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace S2
{
	public class S2 : MelonMod
	{
		private class CustomNPC
		{
			private bool hasSentMessage = false;

			private const string CustomNPCID = "Uncle_Nelson";

			public void Awake()
			{
			}

			public void OnGameStart()
			{
				if (!hasSentMessage)
				{
					SendMessageToPlayer("Thank you for Downloadin S2.Made by Estonia/EstonLa");
					SendMessageToPlayer("If you find Bugs/have suggestions");
					SendMessageToPlayer("S1 Modding Discord: discord.gg/Hhqm6pzAhJ");
					SendMessageToPlayer("guns.lol/estonla");
					hasSentMessage = true;
				}
			}

			private void SendMessageToPlayer(string messageText)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Expected O, but got Unknown
				Message val = new Message(messageText, (ESenderType)1, false, -1);
				if ((Object)(object)NetworkSingleton<MessagingManager>.Instance != (Object)null)
				{
					NetworkSingleton<MessagingManager>.Instance.SendMessage(val, true, "Uncle_Nelson");
				}
			}
		}

		[CompilerGenerated]
		private sealed class <TranspilerPatch>d__4 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private IEnumerator<CodeInstruction> <>s__1;

			private CodeInstruction <instruction>5__2;

			CodeInstruction IEnumerator<CodeInstruction>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TranspilerPatch>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 1u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>s__1 = null;
				<instruction>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>s__1 = instructions.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						goto IL_00ea;
					case 2:
						{
							<>1__state = -3;
							goto IL_00ea;
						}
						IL_00ea:
						<instruction>5__2 = null;
						break;
					}
					if (<>s__1.MoveNext())
					{
						<instruction>5__2 = <>s__1.Current;
						if (<instruction>5__2.opcode == OpCodes.Ldc_R4 && (float)<instruction>5__2.operand == 1000f)
						{
							<>2__current = new CodeInstruction(OpCodes.Ldc_R4, (object)100000000f);
							<>1__state = 1;
							return true;
						}
						<>2__current = <instruction>5__2;
						<>1__state = 2;
						return true;
					}
					<>m__Finally1();
					<>s__1 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>s__1 != null)
				{
					<>s__1.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<TranspilerPatch>d__4 <TranspilerPatch>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<TranspilerPatch>d__ = this;
				}
				else
				{
					<TranspilerPatch>d__ = new <TranspilerPatch>d__4(0);
				}
				<TranspilerPatch>d__.instructions = <>3__instructions;
				return <TranspilerPatch>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <UpdatePlayerStatus>d__6 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public S2 <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <UpdatePlayerStatus>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					if ((Object)(object)<>4__this.playerInstance != (Object)null)
					{
						if (!<>4__this.gameStarted)
						{
							<>4__this.customNPC.OnGameStart();
							<>4__this.gameStarted = true;
						}
					}
					else
					{
						<>4__this.playerInstance = Object.FindObjectOfType<Player>();
					}
					break;
				}
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private Player playerInstance;

		private CustomNPC customNPC;

		private bool gameStarted = false;

		public override void OnInitializeMelon()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			Harmony val = new Harmony("com.yourun123pioyitrygdvbvnhgkytyterw54657r6ioylk541uuuuiqueid.combinedmod");
			val.Patch((MethodBase)AccessTools.Method(typeof(ItemUIManager), "UpdateCashDragAmount", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(S2), "TranspilerPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)AccessTools.Method(typeof(ItemUIManager), "StartDragCash", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(S2), "TranspilerPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)AccessTools.Method(typeof(ItemUIManager), "EndCashDrag", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(S2), "TranspilerPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			customNPC = new CustomNPC();
			customNPC.Awake();
			MelonLogger.Msg("CombinedMod Loaded!");
		}

		[IteratorStateMachine(typeof(<TranspilerPatch>d__4))]
		private static IEnumerable<CodeInstruction> TranspilerPatch(IEnumerable<CodeInstruction> instructions)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TranspilerPatch>d__4(-2)
			{
				<>3__instructions = instructions
			};
		}

		public override void OnApplicationStart()
		{
			playerInstance = Object.FindObjectOfType<Player>();
			MelonCoroutines.Start(UpdatePlayerStatus());
		}

		[IteratorStateMachine(typeof(<UpdatePlayerStatus>d__6))]
		private IEnumerator UpdatePlayerStatus()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <UpdatePlayerStatus>d__6(0)
			{
				<>4__this = this
			};
		}
	}
}
namespace Stack
{
	public class Stack : MelonMod
	{
		[HarmonyPatch(typeof(MixingStation), "Start")]
		private class MixingStationPatch
		{
			private static void Postfix(MixingStation __instance)
			{
				__instance.MixTimePerItem = 1;
				__instance.MaxMixQuantity = 80;
			}
		}

		[HarmonyPatch(typeof(DryingRack), "Awake")]
		private class DryingRackPatch
		{
			private static void Postfix(DryingRack __instance)
			{
				__instance.ItemCapacity = 80;
			}
		}

		[HarmonyPatch(typeof(ItemInstance), "get_StackLimit")]
		private class ItemInstanceStackLimitPatch
		{
			private static void Postfix(ItemInstance __instance, ref int __result)
			{
				__result = 80;
			}
		}

		private const int DefaultStackSize = 20;

		private const int CustomStackSize = 80;

		public override void OnApplicationStart()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.Estonia.UniQueStackMod");
			val.PatchAll();
		}
	}
}
namespace PickPocket
{
	public class PickPocket : MelonMod
	{
		[HarmonyPatch(typeof(InteractableObject), "Hovered")]
		public class CorpseInteractionPatch
		{
			[HarmonyPrefix]
			public static void Prefix(InteractableObject __instance)
			{
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Invalid comparison between Unknown and I4
				if (!((Object)((Component)__instance).gameObject).name.Contains("Pickpocket Interaction"))
				{
					return;
				}
				currentCorpse = __instance;
				NPC componentInParent = ((Component)__instance).GetComponentInParent<NPC>();
				if ((Object)(object)componentInParent != (Object)null && componentInParent.Health.Health <= 0f)
				{
					if ((int)Player.Local.CrimeData.CurrentPursuitLevel > 0)
					{
						__instance.SetMessage("You are Wanted you cant pickPocket");
						__instance.SetInteractableState((EInteractableState)0);
						isCorpseInteractable = false;
					}
					else
					{
						__instance.SetMessage("Pickpocket");
						__instance.SetInteractableState((EInteractableState)0);
						isCorpseInteractable = true;
					}
					__instance.LimitInteractionAngle = true;
					__instance.MaxInteractionRange = 2f;
					__instance.AngleLimit = 90f;
					typeof(InteractableObject).GetMethod("ShowMessage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(__instance, null);
				}
				else
				{
					isCorpseInteractable = false;
				}
			}

			[HarmonyPostfix]
			public static void Postfix()
			{
				if ((Object)(object)currentCorpse != (Object)null && Input.GetKeyUp((KeyCode)101) && isCorpseInteractable)
				{
					NPC componentInParent = ((Component)currentCorpse).GetComponentInParent<NPC>();
					if ((Object)(object)componentInParent != (Object)null)
					{
						NPCInventory component = ((Component)componentInParent).GetComponent<NPCInventory>();
						if ((Object)(object)component != (Object)null)
						{
							MethodInfo method = typeof(NPCInventory).GetMethod("StartPickpocket", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
							if (method != null)
							{
								method.Invoke(component, null);
							}
						}
					}
					currentCorpse = null;
				}
				else if (!Input.GetKeyUp((KeyCode)101))
				{
				}
			}
		}

		private static InteractableObject currentCorpse;

		private static bool isCorpseInteractable;

		public override void OnApplicationStart()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.yourusernaentiedäkattoositäsitten22me.corpsepickpocket");
			val.PatchAll();
		}
	}
}
namespace Slot
{
	public class SlotMachinePatch : MelonMod
	{
		[HarmonyPatch(typeof(SlotMachine), "Awake")]
		public class SlotMachineAwakePatch
		{
			private static void Prefix(SlotMachine __instance)
			{
				((object)__instance).GetType().GetField("BetAmounts", BindingFlags.Static | BindingFlags.Public)?.SetValue(null, NewBetAmounts);
			}
		}

		[HarmonyPatch(typeof(SlotMachine), "GetWinAmount")]
		public class GetWinAmountPatch
		{
			private static void Postfix(ref int __result, EOutcome outcome, int betAmount)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Expected I4, but got Unknown
				switch ((int)outcome)
				{
				case 0:
					__result = betAmount * jackpotMultiplier;
					break;
				case 1:
					__result = betAmount * bigWinMultiplier;
					break;
				case 2:
					__result = betAmount * smallWinMultiplier;
					break;
				case 3:
					__result = betAmount * miniWinMultiplier;
					break;
				default:
					__result = 0;
					break;
				}
			}
		}

		[HarmonyPatch(typeof(SlotMachine), "EvaluateOutcome")]
		public class SlotMachineEvaluateOutcomePatch
		{
			private static void Postfix(SlotMachine __instance, ref EOutcome __result, ESymbol[] outcome)
			{
				float num = Random.Range(0f, 1f);
				if (num > winProbability)
				{
					__result = (EOutcome)4;
				}
				else if (IsUniform(outcome))
				{
					if ((int)outcome[0] == 5)
					{
						__result = (EOutcome)0;
					}
					else if ((int)outcome[0] == 4)
					{
						__result = (EOutcome)1;
					}
					else if (IsFruit(outcome[0]))
					{
						__result = (EOutcome)2;
					}
				}
				else if (IsAllFruit(outcome))
				{
					__result = (EOutcome)3;
				}
				else
				{
					__result = (EOutcome)4;
				}
			}

			private static bool IsFruit(ESymbol symbol)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Invalid comparison between Unknown and I4
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Invalid comparison between Unknown and I4
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Invalid comparison between Unknown and I4
				return (int)symbol == 0 || (int)symbol == 1 || (int)symbol == 2 || (int)symbol == 3;
			}

			private static bool IsAllFruit(ESymbol[] symbols)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				foreach (ESymbol symbol in symbols)
				{
					if (!IsFruit(symbol))
					{
						return false;
					}
				}
				return true;
			}

			private static bool IsUniform(ESymbol[] symbols)
			{
				for (int i = 1; i < symbols.Length; i++)
				{
					if ((int)symbols[i] != (int)symbols[i - 1])
					{
						return false;
					}
				}
				return true;
			}
		}

		private static readonly int[] NewBetAmounts = new int[5] { 50, 100, 250, 500, 2500 };

		private static readonly int jackpotMultiplier = 200;

		private static readonly int bigWinMultiplier = 50;

		private static readonly int smallWinMultiplier = 20;

		private static readonly int miniWinMultiplier = 5;

		private static float winProbability = 0.2f;

		public override void OnInitializeMelon()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.ap543543aawdtel.sc123awd123haw13dedule1.awdxppawadtchawd");
			val.PatchAll();
		}
	}
}
namespace BetterMoneyLaundry
{
	public class BetterMoneyLaundry : MelonMod
	{
		[HarmonyPatch(typeof(Business))]
		public static class BusinessLaunderCapacityPatch
		{
			[HarmonyPatch("Awake")]
			[HarmonyPostfix]
			public static void Postfix(Business __instance)
			{
				switch (((Property)__instance).PropertyName)
				{
				case "Laundromat":
					__instance.LaunderCapacity = 14000f;
					break;
				case "PostOffice":
					__instance.LaunderCapacity = 20000f;
					break;
				case "Car Wash":
					__instance.LaunderCapacity = 26000f;
					break;
				case "Taco Ticklers":
					__instance.LaunderCapacity = 42000f;
					break;
				default:
					__instance.LaunderCapacity = 20000f;
					break;
				}
				MelonLogger.Msg($"Updated LaunderCapacity for {((Property)__instance).PropertyName}: {__instance.LaunderCapacity}");
			}
		}

		public override void OnInitializeMelon()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.apaawdtel.scawdhawdedule1.awdxppawadtchawd");
			val.PatchAll();
		}
	}
}