Decompiled source of CashDrops MONO v1.3.0

CashDrops.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using CashDrops;
using HarmonyLib;
using MelonLoader;
using ScheduleOne.Cartel;
using ScheduleOne.DevUtilities;
using ScheduleOne.Economy;
using ScheduleOne.Employees;
using ScheduleOne.GameTime;
using ScheduleOne.Map;
using ScheduleOne.Money;
using ScheduleOne.NPCs;
using ScheduleOne.NPCs.CharacterClasses;
using ScheduleOne.ObjectScripts.Cash;
using ScheduleOne.Persistence;
using ScheduleOne.Police;
using ScheduleOne.UI;
using ScheduleOne.UI.MainMenu;
using UnityEngine;
using UnityEngine.Events;

[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::CashDrops.CashDrops), "CashDrops", "1.3", "XOWithSauce", null)]
[assembly: MelonColor]
[assembly: MelonOptionalDependencies(new string[] { "FishNet.Runtime" })]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("CashDrops")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CashDrops")]
[assembly: AssemblyTitle("CashDrops")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CashDrops;

public static class BuildInfo
{
	public const string Name = "CashDrops";

	public const string Description = "NPC Cash Drops";

	public const string Author = "XOWithSauce";

	public const string Company = null;

	public const string Version = "1.3";

	public const string DownloadLink = null;
}
public class CashDrops : MelonMod
{
	[HarmonyPatch(typeof(NPCHealth), "KnockOut")]
	public static class NPC_KnockOut_Patch
	{
		public static bool Prefix(NPCHealth __instance)
		{
			if (waitedLoadFlag)
			{
				coros.Add(MelonCoroutines.Start(PreNPCKnockOut(__instance)));
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(NPCHealth), "Die")]
	public static class NPC_Die_Patch
	{
		public static bool Prefix(NPCHealth __instance)
		{
			if (waitedLoadFlag)
			{
				coros.Add(MelonCoroutines.Start(PreNPCKnockOut(__instance)));
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(LoadManager), "ExitToMenu")]
	public static class LoadManager_ExitToMenu_Patch
	{
		public static bool Prefix(SaveInfo autoLoadSave = null, Data mainMenuPopup = null, bool preventLeaveLobby = false)
		{
			lastSaveLoad = false;
			ExitPreTask();
			return true;
		}
	}

	[HarmonyPatch(typeof(DeathScreen), "LoadSaveClicked")]
	public static class DeathScreen_LoadSaveClicked_Patch
	{
		public static bool Prefix(DeathScreen __instance)
		{
			lastSaveLoad = true;
			ExitPreTask();
			return true;
		}
	}

	public class CashCollisionHandler : MonoBehaviour
	{
		public int value;

		private void OnTriggerEnter(Collider collision)
		{
			GameObject gameObject = ((Component)collision).gameObject;
			int layer = gameObject.layer;
			if (layer == 6)
			{
				float num = value switch
				{
					1 => (!(Random.Range(0f, 1f) > 0.9f)) ? Mathf.Round(Random.Range(1f, 10f)) : Mathf.Round(Random.Range(10f, 30f)), 
					2 => (!(Random.Range(0f, 1f) > 0.8f)) ? Mathf.Round(Random.Range(10f, 30f)) : Mathf.Round(Random.Range(30f, 50f)), 
					3 => (!(Random.Range(0f, 1f) > 0.5f)) ? Mathf.Round(Random.Range(30f, 50f)) : Mathf.Round(Random.Range(40f, 90f)), 
					4 => (!(Random.Range(0f, 1f) > 0.5f)) ? Mathf.Round(Random.Range(60f, 90f)) : Mathf.Round(Random.Range(60f, 150f)), 
					5 => (!(Random.Range(0f, 1f) > 0.5f)) ? Mathf.Round(Random.Range(100f, 200f)) : Mathf.Round(Random.Range(100f, 450f)), 
					6 => (!(Random.Range(0f, 1f) > 0.5f)) ? Mathf.Round(Random.Range(250f, 500f)) : Mathf.Round(Random.Range(200f, 650f)), 
					_ => 1f, 
				};
				NetworkSingleton<MoneyManager>.Instance.ChangeCashBalance(num, true, true);
				totalGain += num;
				Object.Destroy((Object)(object)((Component)((Component)this).transform.parent).gameObject);
			}
		}
	}

	public class CashPickup : MonoBehaviour
	{
		public void SetupPickup(int value)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("CashPickupTrigger");
			val.transform.SetParent(((Component)this).transform);
			val.transform.localPosition = Vector3.zero;
			BoxCollider val2 = val.AddComponent<BoxCollider>();
			val2.size = new Vector3(0.5f, 0.5f, 0.5f);
			((Collider)val2).isTrigger = true;
			CashCollisionHandler cashCollisionHandler = val.AddComponent<CashCollisionHandler>();
			cashCollisionHandler.value = value;
		}
	}

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

		private object <>2__current;

		public GameObject go;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(240f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				if ((Object)(object)go != (Object)null)
				{
					Object.Destroy((Object)(object)go);
				}
				<>2__current = null;
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				return false;
			}
		}

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

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

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

		private object <>2__current;

		public GameObject go;

		public int value;

		private CashPickup <pickupComp>5__1;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				<pickupComp>5__1 = go.GetComponent<CashPickup>();
				if ((Object)(object)<pickupComp>5__1 != (Object)null)
				{
					<pickupComp>5__1.SetupPickup(value);
				}
				return false;
			}
		}

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

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

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

		private object <>2__current;

		public Vector3 pos;

		public GameObject baseObj;

		public int lowerAmnt;

		public int upperAmnt;

		public int value;

		private GameObject <bunchBase>5__1;

		private int <i>5__2;

		private GameObject <go>5__3;

		private Rigidbody <rb>5__4;

		private Vector3 <force>5__5;

		private float <torqueX>5__6;

		private float <torqueZ>5__7;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<bunchBase>5__1 = null;
			<go>5__3 = null;
			<rb>5__4 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<bunchBase>5__1 = new GameObject("CashBunchBase");
				<i>5__2 = 0;
				break;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				<go>5__3 = Object.Instantiate<GameObject>(baseObj, pos, Quaternion.identity, <bunchBase>5__1.transform);
				if (!<go>5__3.activeInHierarchy)
				{
					<go>5__3.SetActive(true);
				}
				<rb>5__4 = <go>5__3.GetComponent<Rigidbody>();
				if ((Object)(object)<rb>5__4 != (Object)null)
				{
					<force>5__5 = Vector3.up * 6f;
					<rb>5__4.AddForce(<force>5__5, (ForceMode)1);
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 2;
					return true;
				}
				goto IL_01d1;
			case 2:
				{
					<>1__state = -1;
					if (Random.Range(0, 100) >= 50)
					{
						<force>5__5 = Vector3.right;
					}
					else
					{
						<force>5__5 = Vector3.left;
					}
					<rb>5__4.AddForce(<force>5__5, (ForceMode)1);
					<torqueX>5__6 = Random.Range(-5f, 5f);
					<torqueZ>5__7 = Random.Range(-5f, 5f);
					<rb>5__4.AddTorque(new Vector3(<torqueX>5__6, 0f, <torqueZ>5__7), (ForceMode)1);
					MelonCoroutines.Start(CashPickupDelay(<go>5__3, value));
					goto IL_01d1;
				}
				IL_01d1:
				<go>5__3 = null;
				<rb>5__4 = null;
				<i>5__2++;
				break;
			}
			if (<i>5__2 < Random.Range(lowerAmnt, upperAmnt))
			{
				<>2__current = (object)new WaitForSeconds(0.05f);
				<>1__state = 1;
				return true;
			}
			MelonCoroutines.Start(CashDespawnHandler(<bunchBase>5__1));
			return false;
		}

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

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

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

		private object <>2__current;

		public NPCHealth __instance;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				onCooldown.Add(__instance);
				<>2__current = (object)new WaitForSeconds(60f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				if (onCooldown.Contains(__instance))
				{
					onCooldown.Remove(__instance);
				}
				return false;
			}
		}

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

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

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

		private object <>2__current;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(10f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (registered)
				{
					waitedLoadFlag = true;
				}
				return false;
			}
		}

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

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

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

		private object <>2__current;

		public NPCHealth __instance;

		private NPC <npc>5__1;

		private int <npcStatus>5__2;

		private int <npcType>5__3;

		private int <bonusValue>5__4;

		private EDay <currentDay>5__5;

		private int <currentTime>5__6;

		private EMapRegion <>s__7;

		private Vector3 <topNpc>5__8;

		private int <leastMaxRoll>5__9;

		private int <roll>5__10;

		private int <>s__11;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected I4, but got Unknown
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Invalid comparison between Unknown and I4
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Invalid comparison between Unknown and I4
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Invalid comparison between Unknown and I4
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_062a: Unknown result type (might be due to invalid IL or missing references)
			//IL_065a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			case 1:
			{
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				if (onCooldown.Contains(__instance))
				{
					return false;
				}
				DropsCooldown(__instance);
				<npc>5__1 = ((Component)__instance).GetComponent<NPC>();
				<npcStatus>5__2 = 0;
				EMapRegion region = <npc>5__1.Region;
				<>s__7 = region;
				EMapRegion val = <>s__7;
				switch ((int)val)
				{
				case 0:
					<npcStatus>5__2 = 0;
					break;
				case 1:
					<npcStatus>5__2 = 1;
					break;
				case 2:
					<npcStatus>5__2 = 2;
					break;
				case 3:
					<npcStatus>5__2 = 3;
					break;
				case 4:
					<npcStatus>5__2 = 4;
					break;
				case 5:
					<npcStatus>5__2 = 5;
					break;
				}
				<npcType>5__3 = 1;
				if (<npc>5__1 is Employee)
				{
					<npcType>5__3 = 0;
				}
				if (<npc>5__1 is CartelGoon)
				{
					if (Random.Range(0f, 1f) < 0.05f)
					{
						<npcStatus>5__2 = 4;
						<npcType>5__3 = 4;
					}
					else
					{
						<npcType>5__3 = 2;
					}
				}
				if (<npc>5__1 is PoliceOfficer)
				{
					if (Random.Range(0f, 1f) < 0.5f)
					{
						<npcType>5__3 = 1;
					}
					else
					{
						<npcType>5__3 = 2;
					}
				}
				if (<npc>5__1 is Dealer)
				{
					<npcType>5__3 = 3;
				}
				if (<npc>5__1 is Herbert)
				{
					if (Random.Range(0f, 1f) < 0.05f)
					{
						<npcType>5__3 = 5;
					}
					else
					{
						<npcType>5__3 = 3;
					}
				}
				if (<npc>5__1 is Jeremy)
				{
					<npcType>5__3 = 3;
				}
				if (<npc>5__1 is Mick)
				{
					<npcStatus>5__2 = 3;
					if (Random.Range(0f, 1f) < 0.1f)
					{
						<npcType>5__3 = 5;
						<npcStatus>5__2 = 4;
					}
					else
					{
						<npcType>5__3 = 3;
					}
				}
				if (<npc>5__1 is Tobias)
				{
					<npcType>5__3 = 4;
				}
				if (<npc>5__1 is Stan)
				{
					<npcStatus>5__2 = 2;
					if (Random.Range(0f, 1f) < 0.2f)
					{
						<npcStatus>5__2 = 3;
					}
					else
					{
						<npcType>5__3 = 4;
					}
				}
				if (<npc>5__1 is Fixer)
				{
					<npcStatus>5__2 = 2;
					if (Random.Range(0f, 1f) < 0.2f)
					{
						<npcStatus>5__2 = 4;
					}
					else
					{
						<npcType>5__3 = 5;
					}
				}
				<bonusValue>5__4 = 0;
				<currentDay>5__5 = NetworkSingleton<TimeManager>.Instance.CurrentDay;
				<currentTime>5__6 = NetworkSingleton<TimeManager>.Instance.CurrentTime;
				if ((int)<currentDay>5__5 == 5 || (int)<currentDay>5__5 == 4)
				{
					<bonusValue>5__4++;
					if (<currentTime>5__6 > 2000 && <currentTime>5__6 < 2300)
					{
						<bonusValue>5__4++;
					}
				}
				else if ((int)<currentDay>5__5 == 6)
				{
					if (<currentTime>5__6 > 1100 && <currentTime>5__6 < 1300)
					{
						<bonusValue>5__4++;
					}
				}
				else if (<currentTime>5__6 > 1300 && <currentTime>5__6 < 1900)
				{
					<bonusValue>5__4++;
				}
				else
				{
					<bonusValue>5__4 = 0;
				}
				if ((Object)(object)<npc>5__1 != (Object)null && <npcType>5__3 != 0)
				{
					<topNpc>5__8 = new Vector3(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1f, ((Component)__instance).transform.position.z);
					<leastMaxRoll>5__9 = 3 + <npcStatus>5__2;
					<roll>5__10 = Random.Range(<npcStatus>5__2, <leastMaxRoll>5__9);
					int num = <roll>5__10;
					<>s__11 = num;
					switch (<>s__11)
					{
					case 0:
						MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__8, Note, 1 + <npcType>5__3, 2 + <npcType>5__3, 1 + <bonusValue>5__4));
						break;
					case 1:
						MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__8, Note, 2 + <npcType>5__3, 4 + <npcType>5__3, 1 + <bonusValue>5__4));
						break;
					case 2:
						MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__8, Note, 4 + <npcType>5__3, 8 + <npcType>5__3, 1 + <bonusValue>5__4));
						break;
					case 3:
						MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__8, Note, 6 + <npcType>5__3, 10 + <npcType>5__3, 1 + <bonusValue>5__4));
						break;
					case 4:
						MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__8, Bill, 1 + <npcType>5__3, 3 + <npcType>5__3, 2 + <bonusValue>5__4));
						break;
					case 5:
						MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__8, Bill, 3 + <npcType>5__3, 6 + <npcType>5__3, 2 + <bonusValue>5__4));
						break;
					case 6:
						MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__8, Visuals_Under100, 1, 3 + <npcType>5__3, 3 + <bonusValue>5__4));
						break;
					case 7:
						MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__8, Visuals_Over100, 1, 3 + <npcType>5__3, 4 + <bonusValue>5__4));
						break;
					}
				}
				<>2__current = null;
				<>1__state = 2;
				return true;
			}
			case 2:
				<>1__state = -1;
				return false;
			}
		}

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

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

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

		private object <>2__current;

		public CashDrops <>4__this;

		private CashStackVisuals[] <csv>5__1;

		private CashStackVisuals[] <>s__2;

		private int <>s__3;

		private CashStackVisuals <inst>5__4;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<csv>5__1 = null;
			<>s__2 = null;
			<inst>5__4 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (<>4__this.IsAssignedObjects())
				{
					return false;
				}
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<csv>5__1 = Object.FindObjectsOfType<CashStackVisuals>(true);
				if (<csv>5__1.Length != 0)
				{
					<>s__2 = <csv>5__1;
					<>s__3 = 0;
					goto IL_02b8;
				}
				goto IL_02d3;
			case 2:
				<>1__state = -1;
				if ((Object)(object)Visuals_Over100 == (Object)null && Object.op_Implicit((Object)(object)<inst>5__4.Visuals_Over100))
				{
					Visuals_Over100 = Object.Instantiate<GameObject>(<inst>5__4.Visuals_Over100.gameObject, Vector3.zero, Quaternion.identity, (Transform)null);
					Visuals_Over100.SetActive(false);
					<>4__this.PrepareObject(Visuals_Over100);
				}
				if ((Object)(object)Visuals_Under100 == (Object)null && Object.op_Implicit((Object)(object)<inst>5__4.Visuals_Under100))
				{
					Visuals_Under100 = Object.Instantiate<GameObject>(<inst>5__4.Visuals_Under100.gameObject, Vector3.zero, Quaternion.identity, (Transform)null);
					Visuals_Under100.SetActive(false);
					<>4__this.PrepareObject(Visuals_Under100);
				}
				if ((Object)(object)Bill == (Object)null && Object.op_Implicit((Object)(object)<inst>5__4.Bills.FirstOrDefault()))
				{
					Bill = Object.Instantiate<GameObject>(<inst>5__4.Bills.FirstOrDefault().gameObject, Vector3.zero, Quaternion.identity, (Transform)null);
					Bill.SetActive(false);
					<>4__this.PrepareObject(Bill);
				}
				if ((Object)(object)Note == (Object)null && Object.op_Implicit((Object)(object)<inst>5__4.Notes.FirstOrDefault()))
				{
					Note = Object.Instantiate<GameObject>(<inst>5__4.Notes.FirstOrDefault().gameObject, Vector3.zero, Quaternion.identity, (Transform)null);
					Note.SetActive(false);
					<>4__this.PrepareObject(Note);
				}
				if (<>4__this.IsAssignedObjects())
				{
					return false;
				}
				<inst>5__4 = null;
				<>s__3++;
				goto IL_02b8;
			case 3:
				{
					<>1__state = -1;
					return false;
				}
				IL_02d3:
				<>2__current = null;
				<>1__state = 3;
				return true;
				IL_02b8:
				if (<>s__3 < <>s__2.Length)
				{
					<inst>5__4 = <>s__2[<>s__3];
					<>2__current = (object)new WaitForSeconds(0.3f);
					<>1__state = 2;
					return true;
				}
				<>s__2 = null;
				goto IL_02d3;
			}
		}

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

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

	public static List<object> coros = new List<object>();

	public static GameObject Visuals_Over100 = null;

	public static GameObject Visuals_Under100 = null;

	public static GameObject Bill = null;

	public static GameObject Note = null;

	private static HashSet<NPCHealth> onCooldown = new HashSet<NPCHealth>();

	private static bool registered = false;

	private static bool firstTimeLoad = false;

	private static bool lastSaveLoad = false;

	private static float totalGain = 0f;

	private static bool waitedLoadFlag = false;

	private void OnLoadCompleteCb()
	{
		if (!registered)
		{
			coros.Add(MelonCoroutines.Start(Setup()));
			coros.Add(MelonCoroutines.Start(OnLoadTimer()));
			registered = true;
		}
	}

	public override void OnSceneWasInitialized(int buildIndex, string sceneName)
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		if (buildIndex == 1 && (Object)(object)Singleton<LoadManager>.Instance != (Object)null && !registered && !lastSaveLoad && !firstTimeLoad)
		{
			firstTimeLoad = true;
			Singleton<LoadManager>.Instance.onLoadComplete.AddListener(new UnityAction(OnLoadCompleteCb));
		}
	}

	private static void ExitPreTask()
	{
		registered = false;
		waitedLoadFlag = false;
		foreach (object coro in coros)
		{
			if (coro != null)
			{
				MelonCoroutines.Stop(coro);
			}
		}
		onCooldown.Clear();
		coros.Clear();
	}

	[IteratorStateMachine(typeof(<OnLoadTimer>d__18))]
	private static IEnumerator OnLoadTimer()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <OnLoadTimer>d__18(0);
	}

	[IteratorStateMachine(typeof(<DropsCooldown>d__19))]
	private static IEnumerator DropsCooldown(NPCHealth __instance)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <DropsCooldown>d__19(0)
		{
			__instance = __instance
		};
	}

	[IteratorStateMachine(typeof(<PreNPCKnockOut>d__20))]
	private static IEnumerator PreNPCKnockOut(NPCHealth __instance)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <PreNPCKnockOut>d__20(0)
		{
			__instance = __instance
		};
	}

	[IteratorStateMachine(typeof(<CashDespawnHandler>d__21))]
	private static IEnumerator CashDespawnHandler(GameObject go)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <CashDespawnHandler>d__21(0)
		{
			go = go
		};
	}

	[IteratorStateMachine(typeof(<CashPickupDelay>d__22))]
	private static IEnumerator CashPickupDelay(GameObject go, int value)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <CashPickupDelay>d__22(0)
		{
			go = go,
			value = value
		};
	}

	[IteratorStateMachine(typeof(<CashSpawnRoutine>d__23))]
	private static IEnumerator CashSpawnRoutine(Vector3 pos, GameObject baseObj, int lowerAmnt, int upperAmnt, int value)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <CashSpawnRoutine>d__23(0)
		{
			pos = pos,
			baseObj = baseObj,
			lowerAmnt = lowerAmnt,
			upperAmnt = upperAmnt,
			value = value
		};
	}

	private bool IsAssignedObjects()
	{
		return (Object)(object)Note != (Object)null && (Object)(object)Bill != (Object)null && (Object)(object)Visuals_Under100 != (Object)null && (Object)(object)Visuals_Over100 != (Object)null;
	}

	[IteratorStateMachine(typeof(<Setup>d__27))]
	private IEnumerator Setup()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <Setup>d__27(0)
		{
			<>4__this = this
		};
	}

	private void PrepareObject(GameObject go)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		CashPickup cashPickup = go.AddComponent<CashPickup>();
		BoxCollider val = default(BoxCollider);
		if (!go.TryGetComponent<BoxCollider>(ref val))
		{
			val = go.AddComponent<BoxCollider>();
			val.size = new Vector3(0.2f, 0.2f, 0.2f);
		}
		Rigidbody val2 = default(Rigidbody);
		if (!go.TryGetComponent<Rigidbody>(ref val2))
		{
			val2 = go.AddComponent<Rigidbody>();
			val2.useGravity = true;
			val2.excludeLayers = LayerMask.op_Implicit(6);
		}
	}
}