Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of CashDrops MONO v1.2.0
CashDrops.dll
Decompiled 2 months agousing 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.DevUtilities; using ScheduleOne.Employees; using ScheduleOne.Map; using ScheduleOne.Money; using ScheduleOne.NPCs; using ScheduleOne.ObjectScripts.Cash; using ScheduleOne.Persistence; 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.2", "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.2"; 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) { coros.Add(MelonCoroutines.Start(PreNPCKnockOut(__instance))); return true; } } [HarmonyPatch(typeof(NPCHealth), "Die")] public static class NPC_Die_Patch { public static bool Prefix(NPCHealth __instance) { coros.Add(MelonCoroutines.Start(PreNPCKnockOut(__instance))); 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(0, 100) <= 80) ? Mathf.Round(Random.Range(1f, 20f)) : Mathf.Round(Random.Range(10f, 40f)), 2 => (Random.Range(0, 100) <= 80) ? Mathf.Round(Random.Range(10f, 40f)) : Mathf.Round(Random.Range(30f, 60f)), 3 => (Random.Range(0, 100) <= 80) ? Mathf.Round(Random.Range(30f, 60f)) : Mathf.Round(Random.Range(60f, 100f)), 4 => (Random.Range(0, 100) <= 80) ? Mathf.Round(Random.Range(60f, 100f)) : Mathf.Round(Random.Range(100f, 200f)), _ => 1f, }; NetworkSingleton<MoneyManager>.Instance.ChangeCashBalance(num, true, false); 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__11 : 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__11(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(60f); <>1__state = 1; return true; case 1: <>1__state = -1; 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__12 : 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__12(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; <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__13 : 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__13(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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) 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; <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_01c1; 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_01c1; } IL_01c1: <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 <PreNPCKnockOut>d__10 : 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 EMapRegion <>s__3; private Vector3 <topNpc>5__4; private int <leastMaxRoll>5__5; private int <roll>5__6; private int <>s__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PreNPCKnockOut>d__10(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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected I4, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0284: 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; <npc>5__1 = ((Component)__instance).GetComponent<NPC>(); <npcStatus>5__2 = 0; EMapRegion region = <npc>5__1.Region; <>s__3 = region; EMapRegion val = <>s__3; 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; } if ((Object)(object)<npc>5__1 != (Object)null && !(<npc>5__1 is Employee)) { <topNpc>5__4 = new Vector3(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1f, ((Component)__instance).transform.position.z); <leastMaxRoll>5__5 = 3 + <npcStatus>5__2; <roll>5__6 = Random.Range(<npcStatus>5__2, <leastMaxRoll>5__5); int num = <roll>5__6; <>s__7 = num; switch (<>s__7) { case 0: MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__4, Note, 1, 2, 1)); break; case 1: MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__4, Note, 1, 3, 1)); break; case 2: MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__4, Note, 4, 8, 1)); break; case 3: MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__4, Note, 10, 20, 1)); break; case 4: MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__4, Bill, 1, 3, 2)); break; case 5: MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__4, Bill, 3, 6, 2)); break; case 6: MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__4, Visuals_Under100, 1, 4, 3)); break; case 7: MelonCoroutines.Start(CashSpawnRoutine(<topNpc>5__4, Visuals_Over100, 1, 3, 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__17 : 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__17(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(10f); <>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 bool registered = false; private void OnLoadCompleteCb() { if (!registered) { coros.Add(MelonCoroutines.Start(Setup())); registered = true; } } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown if (buildIndex == 1) { if ((Object)(object)Singleton<LoadManager>.Instance != (Object)null && !registered) { Singleton<LoadManager>.Instance.onLoadComplete.AddListener(new UnityAction(OnLoadCompleteCb)); } return; } registered = false; foreach (object coro in coros) { MelonCoroutines.Stop(coro); } coros.Clear(); } [IteratorStateMachine(typeof(<PreNPCKnockOut>d__10))] private static IEnumerator PreNPCKnockOut(NPCHealth __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PreNPCKnockOut>d__10(0) { __instance = __instance }; } [IteratorStateMachine(typeof(<CashDespawnHandler>d__11))] private static IEnumerator CashDespawnHandler(GameObject go) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CashDespawnHandler>d__11(0) { go = go }; } [IteratorStateMachine(typeof(<CashPickupDelay>d__12))] private static IEnumerator CashPickupDelay(GameObject go, int value) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CashPickupDelay>d__12(0) { go = go, value = value }; } [IteratorStateMachine(typeof(<CashSpawnRoutine>d__13))] 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__13(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__17))] private IEnumerator Setup() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Setup>d__17(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); } } }